From 4486ba449575d95a3dd8f6ebd192353302b60101 Mon Sep 17 00:00:00 2001 From: Simon Kornblith Date: Thu, 18 Apr 2013 15:43:07 -0400 Subject: [PATCH] Remove "%" from list of unencoded entities @aurimasv's patch from https://github.com/zotero/zotero/pull/304#issuecomment-16562271 --- chrome/content/zotero/xpcom/attachments.js | 7 +------ chrome/content/zotero/xpcom/file.js | 2 +- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index b5909b609c..19378d7bb2 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -51,12 +51,7 @@ Zotero.Attachments = new function(){ Zotero.debug('Importing attachment from file'); // Try decoding URI entities, since we're going to strip '%' - var newName = file.leafName; - try { - newName = decodeURIComponent(file.leafName); - } - catch (e) {} - newName = Zotero.File.getValidFileName(newName); + var newName = Zotero.File.getValidFileName(file.leafName); if (!file.isFile()) { throw ("'" + file.leafName + "' must be a file in Zotero.Attachments.importFromFile()"); diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index 3e98deef53..9ad7eec4e6 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -360,7 +360,7 @@ Zotero.File = new function(){ function getValidFileName(fileName, skipXML) { // TODO: use space instead, and figure out what's doing extra // URL encode when saving attachments that trigger this - fileName = fileName.replace(/[\/\\\?%\*:|"<>]/g, ''); + fileName = fileName.replace(/[\/\\\?\*:|"<>]/g, ''); // Replace newlines and tabs (which shouldn't be in the string in the first place) with spaces fileName = fileName.replace(/[\r\n\t]+/g, ' '); // Replace various thin spaces