diff --git a/chrome/content/zotero/xpcom/file.js b/chrome/content/zotero/xpcom/file.js index 9fe1133b66..96e6296b43 100644 --- a/chrome/content/zotero/xpcom/file.js +++ b/chrome/content/zotero/xpcom/file.js @@ -1230,6 +1230,12 @@ Zotero.File = new function(){ ext = '.' + ext; } + if (ext.length >= maxLength) { + // Improve resulting truncated filename by dropping extension if it wouldn't fit within + // the limit. e.g. for (lorem.json, 5) it returns "lorem", instead of ".json" + ext = ''; + } + return fn.substr(0,maxLength-ext.length) + ext; }