From 0b36cc47b9bd49c46de41e24ce45e27bcaec7eeb Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Sun, 10 Jul 2011 21:59:19 +0000 Subject: [PATCH] Fix handling of relative URIs --- chrome/content/zotero/xpcom/utilities.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index fd3c5ea87..d6f966883 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -1331,15 +1331,16 @@ Zotero.Utilities.Translate.prototype._convertURL = function(url) { } else { if(protocolRe.test(url)) return url; - if(url.indexOf(":") !== -1) { - // don't allow protocol switches - throw "Invalid URL supplied for HTTP request"; - } - - // resolve relative URIs - return Components.classes["@mozilla.org/network/io-service;1"]. + // resolve local URL + var resolved = Components.classes["@mozilla.org/network/io-service;1"]. getService(Components.interfaces.nsIIOService). newURI(this._translate.location, "", null).resolve(url); + + if(!protocolRe.test(resolved)) { + throw new Error("Invalid URL supplied for HTTP request: "+url); + } + + return resolved; } }