www

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

commit 6fe1c1cbba998b95776e022730e0703b18b33b88
parent 61300e4dd750d72381346bb3aace3d29809ae97b
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu, 18 Apr 2013 02:52:36 -0400

Handle pathological case with backslashes in path

Diffstat:
Mchrome/content/zotero/xpcom/translation/translate_item.js | 11++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/xpcom/translation/translate_item.js b/chrome/content/zotero/xpcom/translation/translate_item.js @@ -314,11 +314,10 @@ Zotero.Translate.ItemSaver.prototype = { "_parseRelativePath":function(path) { try { var file = this._baseURI.QueryInterface(Components.interfaces.nsIFileURL).file.parent; - var splitPath = path.split(/[\/\\]/g); + var splitPath = path.split(/\//g); for(var i=0; i<splitPath.length; i++) { if(splitPath[i] !== "") file.append(splitPath[i]); } - Zotero.debug("Testing "+file.path); if(file.exists()) return file; } catch(e) { Zotero.logError(e); @@ -343,7 +342,13 @@ Zotero.Translate.ItemSaver.prototype = { } else if(path.substr(0, 7) !== "file://") { // If it was a fully qualified file URI, we can give up now - // Next, try to parse as relative path + // Next, try to parse as relative path, replacing backslashes with slashes + if((file = this._parseRelativePath(path.replace(/\\/g, "/")))) { + Zotero.debug("Translate: Got file "+path+" as relative path"); + return file; + } + + // Next, try to parse as relative path, without replacing backslashes with slashes if((file = this._parseRelativePath(path))) { Zotero.debug("Translate: Got file "+path+" as relative path"); return file;