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

Bug Fix for https://github.com/joyent/node/issues/562 #1078

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ var protocolPattern = /^([a-z0-9]+:)/i,
// protocols that never have a hostname.
hostlessProtocol = {
'javascript': true,
'javascript:': true,
'file': true,
'file:': true
'javascript:': true
},
// protocols that always have a path component.
pathedProtocol = {
Expand Down
30 changes: 28 additions & 2 deletions test/simple/test-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,38 @@ var parseTests = {
'file:///etc/passwd' : {
'href': 'file:///etc/passwd',
'protocol': 'file:',
'pathname': '///etc/passwd'
'pathname': '/etc/passwd',
'hostname': ''
},
'file://localhost/etc/passwd' : {
'href': 'file://localhost/etc/passwd',
'protocol': 'file:',
'pathname': '/etc/passwd',
'hostname': 'localhost'
},
'file://foo/etc/passwd' : {
'href': 'file://foo/etc/passwd',
'protocol': 'file:',
'pathname': '/etc/passwd',
'hostname': 'foo'
},
'file:///etc/node/' : {
'href': 'file:///etc/node/',
'protocol': 'file:',
'pathname': '///etc/node/'
'pathname': '/etc/node/',
'hostname': ''
},
'file://localhost/etc/node/' : {
'href': 'file://localhost/etc/node/',
'protocol': 'file:',
'pathname': '/etc/node/',
'hostname': 'localhost'
},
'file://foo/etc/node/' : {
'href': 'file://foo/etc/node/',
'protocol': 'file:',
'pathname': '/etc/node/',
'hostname': 'foo'
},
'http:/baz/../foo/bar' : {
'href': 'http:/baz/../foo/bar',
Expand Down