Skip to content

Commit

Permalink
Improve compatibility with uri-js (#84)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
gurgunday committed Jun 10, 2024
1 parent 7ffca1e commit b8b98b1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
1 change: 1 addition & 0 deletions test/compatibility.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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]',
Expand Down

0 comments on commit b8b98b1

Please sign in to comment.