Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions lib/internal/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,10 @@ function getPathFromURLWin32(url) {
}
}
pathname = SideEffectFreeRegExpPrototypeSymbolReplace(FORWARD_SLASH, pathname, '\\');
pathname = decodeURIComponent(pathname);
// Fast-path: if there is no percent-encoding, avoid decodeURIComponent.
if (StringPrototypeIncludes(pathname, '%')) {
pathname = decodeURIComponent(pathname);
}
if (hostname !== '') {
// If hostname is set, then we have a UNC path
// Pass the hostname through domainToUnicode just in case
Expand Down Expand Up @@ -1578,7 +1581,8 @@ function getPathFromURLPosix(url) {
}
}
}
return decodeURIComponent(pathname);
// Fast-path: if there is no percent-encoding, avoid decodeURIComponent.
return StringPrototypeIncludes(pathname, '%') ? decodeURIComponent(pathname) : pathname;
}

function getPathBufferFromURLPosix(url) {
Expand Down
Loading