File tree 2 files changed +15
-3
lines changed
browser-vm/src/dynamicNode
2 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -52,8 +52,16 @@ export class DynamicNodeProcessor {
52
52
const src = el . getAttribute ( 'src' ) ;
53
53
const href = el . getAttribute ( 'href' ) ;
54
54
if ( this . sandbox . options . fixStaticResourceBaseUrl ) {
55
- src && ( el . src = transformUrl ( baseUrl , src ) ) ;
56
- href && ( el . href = transformUrl ( baseUrl , href ) ) ;
55
+ const transformUrlSrc = src && transformUrl ( baseUrl , src ) ;
56
+ const transformUrlHref = href && transformUrl ( baseUrl , href ) ;
57
+ // Consistent values do not need to be overwritten
58
+ if ( transformUrlSrc !== src ) {
59
+ el . src = transformUrlSrc ;
60
+ }
61
+
62
+ if ( transformUrlHref !== href ) {
63
+ el . href = transformUrlHref ;
64
+ }
57
65
}
58
66
59
67
const url = el . src || el . href ;
Original file line number Diff line number Diff line change @@ -371,7 +371,11 @@ export function isAbsolute(url: string) {
371
371
}
372
372
373
373
export function transformUrl ( resolvePath : string , curPath : string ) {
374
- if ( curPath . startsWith ( 'http' ) || curPath . startsWith ( '//' ) ) {
374
+ if (
375
+ curPath . startsWith ( 'http' ) ||
376
+ curPath . startsWith ( '//' ) ||
377
+ curPath . startsWith ( 'blob:' )
378
+ ) {
375
379
return curPath ;
376
380
}
377
381
const baseUrl = new URL ( resolvePath , location . href ) ;
You can’t perform that action at this time.
0 commit comments