From b8b98b1a6c64f0fba2eeb387e69df088f953d6b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?G=C3=BCrg=C3=BCn=20Day=C4=B1o=C4=9Flu?= Date: Mon, 10 Jun 2024 15:35:05 +0300 Subject: [PATCH] Improve compatibility with uri-js (#84) * add test * improve compat * improve compat * add bench workflow * fix * fix * third time is the charm * third time is the charm * third time is the charm * remove bench workflow --- index.js | 2 +- test/compatibility.test.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index aa2daa3..a2cd183 100644 --- a/index.js +++ b/index.js @@ -273,7 +273,7 @@ function parse (uri, opts) { parsed.host = unescape(parsed.host) } if (parsed.path !== undefined && parsed.path.length) { - parsed.path = encodeURI(parsed.path) + parsed.path = escape(unescape(parsed.path)) } if (parsed.fragment !== undefined && parsed.fragment.length) { parsed.fragment = encodeURI(decodeURI(parsed.fragment)) diff --git a/test/compatibility.test.js b/test/compatibility.test.js index 73bc65a..5c5edc4 100644 --- a/test/compatibility.test.js +++ b/test/compatibility.test.js @@ -9,6 +9,7 @@ test('compatibility Parse', (t) => { const toParse = [ '//www.g.com/error\n/bleh/bleh', 'https://fastify.org', + '/definitions/Record%3Cstring%2CPerson%3E', '//10.10.10.10', '//10.10.000.10', '//[2001:db8::7%en0]',