mirror of
https://github.com/PR0M3TH3AN/Artstr-Studio.git
synced 2026-10-27 08:40:39 +00:00
Merge pull request #5 from PR0M3TH3AN/codex/fix-bugs-in-the-codebase
Require absolute HTTP(S) image URLs in normalizeImageUrl
This commit is contained in:
1 file changed
+4
-1
+4
-1
@@ -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.');
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user