Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

url.parse encodes components as of 0.12 #25636

Closed
mojodna opened this issue Jul 6, 2015 · 4 comments
Closed

url.parse encodes components as of 0.12 #25636

mojodna opened this issue Jul 6, 2015 · 4 comments

Comments

@mojodna
Copy link

mojodna commented Jul 6, 2015

This behavior changed between v0.10.x and v0.12.x and does not appear to be documented anywhere.

node.js v0.12.6:

> url.parse("http://example.com/{z}/{x}/{y}.png#foo{}")
{ protocol: 'http:',
  slashes: true,
  auth: null,
  host: 'example.com',
  port: null,
  hostname: 'example.com',
  hash: '#foo%7B%7D',
  search: null,
  query: null,
  pathname: '/%7Bz%7D/%7Bx%7D/%7By%7D.png',
  path: '/%7Bz%7D/%7Bx%7D/%7By%7D.png',
  href: 'http://example.com/%7Bz%7D/%7Bx%7D/%7By%7D.png#foo%7B%7D' }

node.js v0.10.39:

> url.parse("http://example.com/{z}/{x}/{y}.png#foo{}")
{ protocol: 'http:',
  slashes: true,
  auth: null,
  host: 'example.com',
  port: null,
  hostname: 'example.com',
  hash: '#foo{}',
  search: null,
  query: null,
  pathname: '/{z}/{x}/{y}.png',
  path: '/{z}/{x}/{y}.png',
  href: 'http://example.com/{z}/{x}/{y}.png#foo{}' }

This also means that URIs no longer roundtrip:

node.js v0.12.6:

> url.format(url.parse("http://example.com/{z}/{x}/{y}.png#foo{}"))
'http://example.com/%7Bz%7D/%7Bx%7D/%7By%7D.png#foo%7B%7D'

node.js v0.10.39:

> url.format(url.parse("http://example.com/{z}/{x}/{y}.png#foo{}"))
'http://example.com/{z}/{x}/{y}.png#foo{}'

See also nodejs/node#2113

@Fishrock123
Copy link

Previously?: #5474

@brendanashworth
Copy link

Documentation was added on master in nodejs/node@47e5cf7, I'm not sure if this is worth backporting. @Fishrock123 ?

@Fishrock123
Copy link

cc @nodejs/lts

@jasnell
Copy link
Member

jasnell commented Oct 6, 2015

For doc changes, I'm fairly +1 on back porting in general.

@Trott Trott closed this as completed Apr 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants