Spaces:
Build error
Build error
fix: explicitly reject non http protocols
Browse files
backend/functions/src/cloud-functions/crawler.ts
CHANGED
|
@@ -195,6 +195,12 @@ ${this.content}
|
|
| 195 |
let urlToCrawl;
|
| 196 |
try {
|
| 197 |
urlToCrawl = new URL(normalizeUrl(noSlashURL.trim(), { stripWWW: false, removeTrailingSlash: false, removeSingleSlash: false }));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
} catch (err) {
|
| 199 |
throw new ParamValidationError({
|
| 200 |
message: `${err}`,
|
|
|
|
| 195 |
let urlToCrawl;
|
| 196 |
try {
|
| 197 |
urlToCrawl = new URL(normalizeUrl(noSlashURL.trim(), { stripWWW: false, removeTrailingSlash: false, removeSingleSlash: false }));
|
| 198 |
+
if (urlToCrawl.protocol !== 'http:' && urlToCrawl.protocol !== 'https:') {
|
| 199 |
+
throw new ParamValidationError({
|
| 200 |
+
message: `Invalid protocol ${urlToCrawl.protocol}`,
|
| 201 |
+
path: 'url'
|
| 202 |
+
});
|
| 203 |
+
}
|
| 204 |
} catch (err) {
|
| 205 |
throw new ParamValidationError({
|
| 206 |
message: `${err}`,
|