[Pkg-javascript-commits] [sockjs-client] 152/434: strip trailing slashes in URL, to avoid possible double slashes after URL concatenation
Tonnerre Lombard
tonnerre-guest at moszumanska.debian.org
Wed Jan 8 00:47:10 UTC 2014
This is an automated email from the git hooks/post-receive script.
tonnerre-guest pushed a commit to branch master
in repository sockjs-client.
commit 7f44f51924c6e0d3ac590b0fd36681bf229ca6a8
Author: Vladimir Dronnikov <dronnikov at gmail.com>
Date: Sat Sep 17 22:37:19 2011 +0400
strip trailing slashes in URL, to avoid possible double slashes after URL concatenation
---
lib/utils.js | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lib/utils.js b/lib/utils.js
index 15144a1..56e1758 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -321,6 +321,8 @@ utils.bind = function(fun, that) {
utils.amendUrl = function(url) {
var dl = _document.location;
+ // falsy url means use current document location as url
+ if (!url) url = dl;
// '//abc' --> 'http://abc'
if (url.indexOf('//') === 0) {
url = dl.protocol + url;
@@ -329,7 +331,7 @@ utils.amendUrl = function(url) {
if (url.indexOf('/') === 0) {
url = dl.protocol + '//' + dl.host + url;
}
- return url;
+ return url.replace(/\/+$/,''); // N.B. strip trailing slashes
};
// IE doesn't support [].indexOf.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/sockjs-client.git
More information about the Pkg-javascript-commits
mailing list