www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 0b36cc47b9bd49c46de41e24ce45e27bcaec7eeb
parent dde68a51fee2bac1cf7fc46145e3edb4e7f56bef
Author: Simon Kornblith <simon@simonster.com>
Date:   Sun, 10 Jul 2011 21:59:19 +0000

Fix handling of relative URIs


Diffstat:
Mchrome/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 @@ -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; } }