Fix image URL validation to require absolute HTTP(S) URLs

This commit is contained in:
thePR0M3TH3AN committed 2026-05-16 12:37:05 -04:00
1 parent 5a60b0f090
commit bf68275f34
1 file changed
+4 -1
+4 -1
View File
@@ -2592,7 +2592,10 @@
function normalizeImageUrl(raw) {
const value = String(raw || '').trim();
if (!value) throw new Error('Enter an image URL.');
const parsed = new URL(value, window.location.href);
if (!/^https?:\/\//i.test(value)) {
throw new Error('Use a full http or https image URL.');
}
const parsed = new URL(value);
if (!['http:', 'https:'].includes(parsed.protocol)) {
throw new Error('Use an http or https image URL.');
}