Remove "%" from list of unencoded entities
@aurimasv's patch from https://github.com/zotero/zotero/pull/304#issuecomment-16562271
This commit is contained in:
parent
dbd36a935f
commit
4486ba4495
2 changed files with 2 additions and 7 deletions
|
@ -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()");
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue