whatwg-url
Advanced tools
Comparing version 4.1.0 to 4.1.1
@@ -427,8 +427,18 @@ "use strict"; | ||
function popPath(url) { | ||
if (url.scheme !== "file" || !url.path.filter(seg => /^[A-Za-z](|:)$/.test(seg)).length) { | ||
url.path.pop(); | ||
function shortenPath(url) { | ||
const path = url.path; | ||
if (path.length === 0) { | ||
return; | ||
} | ||
if (url.scheme === "file" && path.length === 1 && isNormalizedWindowsDriveLetter(path[0])) { | ||
return; | ||
} | ||
path.pop(); | ||
} | ||
function isNormalizedWindowsDriveLetter(string) { | ||
return /^[A-Za-z]:$/.test(string); | ||
} | ||
function URLStateMachine(input, base, encodingOverride, url, stateOverride) { | ||
@@ -838,3 +848,3 @@ this.pointer = 0; | ||
this.url.path = this.base.path.slice(); | ||
popPath(this.url); | ||
shortenPath(this.url); | ||
} else { | ||
@@ -918,3 +928,3 @@ this.parseError = true; | ||
if (isDoubleDot(this.buffer)) { | ||
popPath(this.url); | ||
shortenPath(this.url); | ||
if (c !== 47 && !(specialSchemas[this.url.scheme] !== undefined && c === 92)) { | ||
@@ -1031,3 +1041,3 @@ this.url.path.push(""); | ||
URLStateMachine.prototype["parse fragment"] = function parseFragment(c, cStr) { | ||
URLStateMachine.prototype["parse fragment"] = function parseFragment(c) { | ||
if (isNaN(c)) { // do nothing | ||
@@ -1034,0 +1044,0 @@ } else if (c === 0x0) { |
{ | ||
"name": "whatwg-url", | ||
"version": "4.1.0", | ||
"version": "4.1.1", | ||
"description": "An implementation of the WHATWG URL Standard's URL API and parsing machinery", | ||
@@ -5,0 +5,0 @@ "main": "lib/public-api.js", |
@@ -7,3 +7,3 @@ # whatwg-url | ||
whatwg-url is currently up to date with the URL spec up to commit [e322a8](https://github.com/whatwg/url/tree/e322a8a79246b3f7c026bc9e705f22f069d1bde6). | ||
whatwg-url is currently up to date with the URL spec up to commit [373dbe](https://github.com/whatwg/url/tree/373dbedbbf0596f723ce8a195923da98b698aeb0). | ||
@@ -10,0 +10,0 @@ ## API |
Sorry, the diff of this file is not supported yet
401525
23
1774