parseurl icon indicating copy to clipboard operation
parseurl copied to clipboard

url.parse is deprecated

Open ShenHongFei opened this issue 1 year ago • 1 comments

https://github.com/nodejs/node/pull/55017

(node:33948) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
    at urlParse (node:url:129:13)
    at fastparse (webpack://my-repl/node_modules/.pnpm/[email protected]/node_modules/parseurl/index.js:97:1)
    at parseurl (webpack://my-repl/node_modules/.pnpm/[email protected]/node_modules/parseurl/index.js:51:1)
    at Object.get path (webpack://my-repl/node_modules/.pnpm/[email protected]_patch_hash=p7ybv54qzz4vmboaajk6ep5psi/node_modules/koa/lib/request.js:145:1)
    at Object.router (D:\0\lib\server.ts:763:66)
    at dispatch (webpack://my-repl/node_modules/.pnpm/[email protected]/node_modules/koa-compose/index.js:42:1)
    at cors (webpack://my-repl/node_modules/.pnpm/@[email protected]/node_modules/@koa/cors/index.js:109:1)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async compressMiddleware (webpack://my-repl/node_modules/.pnpm/[email protected]/node_modules/koa-compress/lib/index.js:56:1)
    at async Object.entry (D:\0\lib\server.ts:724:13)

Can it be achieved by other alternative methods?

ShenHongFei avatar Oct 21 '24 08:10 ShenHongFei

You can simply replace it with

const url = new URL('<maybe_an_url>')

Namchee avatar Apr 22 '25 14:04 Namchee