summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2014-03-25 14:16:55 -0700
committerisaacs <i@izs.me>2014-04-15 15:30:43 -0700
commit9520adeb37f5ebe02a68669ec97770f4869705bb (patch)
tree3f39ba1a8d82611cbd1d42edab4fe8180889316c /lib
parent1bd4f3a605216838619e4d7dc1eb1600b1deb91f (diff)
downloadandroid-node-v8-9520adeb37f5ebe02a68669ec97770f4869705bb.tar.gz
android-node-v8-9520adeb37f5ebe02a68669ec97770f4869705bb.tar.bz2
android-node-v8-9520adeb37f5ebe02a68669ec97770f4869705bb.zip
url: treat \ the same as /
See https://code.google.com/p/chromium/issues/detail?id=25916 Parse URLs with backslashes the same as web browsers, by replacing all backslashes with forward slashes, except those that occur after the first # character.
Diffstat (limited to 'lib')
-rw-r--r--lib/url.js6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/url.js b/lib/url.js
index 09e9cceb42..c13f74b5dd 100644
--- a/lib/url.js
+++ b/lib/url.js
@@ -107,6 +107,12 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) {
throw new TypeError("Parameter 'url' must be a string, not " + typeof url);
}
+ // Copy chrome, IE, opera backslash-handling behavior.
+ // See: https://code.google.com/p/chromium/issues/detail?id=25916
+ var hashSplit = url.split('#');
+ hashSplit[0] = hashSplit[0].replace(/\\/g, '/');
+ url = hashSplit.join('#');
+
var rest = url;
// trim before proceeding.