Skip to content

Commit

Permalink
file:// actually may have a host, because we are a non-strict parser,…
Browse files Browse the repository at this point in the history
… we even allow the full authority - #158
  • Loading branch information
rodneyrehm committed Aug 20, 2014
1 parent 87c0458 commit 7ccc328
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
3 changes: 0 additions & 3 deletions src/URI.js
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,6 @@
if (parts.protocol && !parts.protocol.match(URI.protocol_expression)) {
// : may be within the path
parts.protocol = undefined;
} else if (parts.protocol === 'file') {
// the file scheme: does not contain an authority
string = string.substring(pos + 3);
} else if (string.substring(pos + 1, pos + 3) === '//') {
string = string.substring(pos + 3);

Expand Down
10 changes: 5 additions & 5 deletions test/urls.js
Original file line number Diff line number Diff line change
Expand Up @@ -1184,14 +1184,14 @@ var urls = [{
}
}, {
name: 'file:// Windows-Drive-Letter',
url: 'file://C:/WINDOWS/foo.txt',
url: 'file:///C:/WINDOWS/foo.txt',
parts: {
protocol: 'file',
username: null,
password: null,
hostname: null,
port: null,
path: 'C:/WINDOWS/foo.txt',
path: '/C:/WINDOWS/foo.txt',
query: null,
fragment: null
},
Expand All @@ -1200,16 +1200,16 @@ var urls = [{
username: '',
password: '',
port: '',
path: 'C:/WINDOWS/foo.txt',
path: '/C:/WINDOWS/foo.txt',
query: '',
fragment: '',
resource: 'C:/WINDOWS/foo.txt',
resource: '/C:/WINDOWS/foo.txt',
authority: '',
userinfo: '',
subdomain: '',
domain: '',
tld: '',
directory: 'C:/WINDOWS',
directory: '/C:/WINDOWS',
filename: 'foo.txt',
suffix: 'txt',
hash: '',
Expand Down

0 comments on commit 7ccc328

Please sign in to comment.