mirror of
https://git.mirrors.martin98.com/https://github.com/jina-ai/reader
synced 2025-08-15 20:05:57 +08:00
fix: explicitly reject non http protocols
This commit is contained in:
parent
abc817e960
commit
d4ca381c38
@ -195,6 +195,12 @@ ${this.content}
|
|||||||
let urlToCrawl;
|
let urlToCrawl;
|
||||||
try {
|
try {
|
||||||
urlToCrawl = new URL(normalizeUrl(noSlashURL.trim(), { stripWWW: false, removeTrailingSlash: false, removeSingleSlash: false }));
|
urlToCrawl = new URL(normalizeUrl(noSlashURL.trim(), { stripWWW: false, removeTrailingSlash: false, removeSingleSlash: false }));
|
||||||
|
if (urlToCrawl.protocol !== 'http:' && urlToCrawl.protocol !== 'https:') {
|
||||||
|
throw new ParamValidationError({
|
||||||
|
message: `Invalid protocol ${urlToCrawl.protocol}`,
|
||||||
|
path: 'url'
|
||||||
|
});
|
||||||
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
throw new ParamValidationError({
|
throw new ParamValidationError({
|
||||||
message: `${err}`,
|
message: `${err}`,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user