MCPcopy Index your code
hub / github.com/nodejs/node / getPathFromURLPosix

Function getPathFromURLPosix

lib/internal/url.js:1580–1598  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

1578}
1579
1580function getPathFromURLPosix(url) {
1581 if (url.hostname !== '') {
1582 throw new ERR_INVALID_FILE_URL_HOST(platform);
1583 }
1584 const pathname = url.pathname;
1585 for (let n = 0; n < pathname.length; n++) {
1586 if (pathname[n] === '%') {
1587 const third = StringPrototypeCodePointAt(pathname, n + 2) | 0x20;
1588 if (pathname[n + 1] === '2' && third === 102) {
1589 throw new ERR_INVALID_FILE_URL_PATH(
1590 'must not include encoded / characters',
1591 url,
1592 );
1593 }
1594 }
1595 }
1596 // Fast-path: if there is no percent-encoding, avoid decodeURIComponent.
1597 return StringPrototypeIncludes(pathname, '%') ? decodeURIComponent(pathname) : pathname;
1598}
1599
1600function getPathBufferFromURLPosix(url) {
1601 if (url.hostname !== '') {

Callers 1

fileURLToPathFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…