File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -1472,7 +1472,10 @@ function getPathFromURLWin32(url) {
14721472 }
14731473 }
14741474 pathname = SideEffectFreeRegExpPrototypeSymbolReplace ( FORWARD_SLASH , pathname , '\\' ) ;
1475- pathname = decodeURIComponent ( pathname ) ;
1475+ // Fast-path: if there is no percent-encoding, avoid decodeURIComponent.
1476+ if ( StringPrototypeIndexOf ( pathname , '%' ) !== - 1 ) {
1477+ pathname = decodeURIComponent ( pathname ) ;
1478+ }
14761479 if ( hostname !== '' ) {
14771480 // If hostname is set, then we have a UNC path
14781481 // Pass the hostname through domainToUnicode just in case
@@ -1578,7 +1581,8 @@ function getPathFromURLPosix(url) {
15781581 }
15791582 }
15801583 }
1581- return decodeURIComponent ( pathname ) ;
1584+ // Fast-path: if there is no percent-encoding, avoid decodeURIComponent.
1585+ return StringPrototypeIndexOf ( pathname , '%' ) !== - 1 ? decodeURIComponent ( pathname ) : pathname ;
15821586}
15831587
15841588function getPathBufferFromURLPosix ( url ) {
You can’t perform that action at this time.
0 commit comments