There was an error while loading. Please reload this page.
1 parent c088aa0 commit 1b4d5adCopy full SHA for 1b4d5ad
1 file changed
src/utils/helpers.js
@@ -98,13 +98,10 @@ export function parseContent(content) {
98
*/
99
100
export function extractURL(value) {
101
- const urlStart = value.indexOf("url(");
102
- if (urlStart === -1) return null;
103
- let url = value.slice(urlStart + 4).trim(); // Remove "url("
104
- if (url.endsWith(")")) url = url.slice(0, -1).trim(); // Remove trailing ")"
105
- if ((url.startsWith('"') && url.endsWith('"')) || (url.startsWith("'") && url.endsWith("'"))) {
106
- url = url.slice(1, -1);
107
- }
+ const match = value.match(/url\((['"]?)(.*?)(\1)\)/);
+ if (!match) return null;
+
+ const url = match[2].trim();
108
if (url.startsWith('#')) return null;
109
return url;
110
}
0 commit comments