www

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

commit 4486ba449575d95a3dd8f6ebd192353302b60101
parent dbd36a935ff7c765ccff264e9d735b99a320a40e
Author: Simon Kornblith <simon@simonster.com>
Date:   Thu, 18 Apr 2013 15:43:07 -0400

Remove "%" from list of unencoded entities

@aurimasv's patch from https://github.com/zotero/zotero/pull/304#issuecomment-16562271

Diffstat:
Mchrome/content/zotero/xpcom/attachments.js | 7+------
Mchrome/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 @@ -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 @@ -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