From aab90527ecdd91c75e91694c6f50e4fdb646b366 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Wed, 31 Jul 2024 16:30:48 -0400 Subject: [PATCH] isRenameAllowedForType(): Handle empty autoRenameFiles.fileTypes Previously, an empty value for the pref would be treated as matching *every* MIME type, because s.startsWith('') is true for any string. That meant that unchecking all the file type checkboxes would actually enable renaming for all files. --- chrome/content/zotero/xpcom/attachments.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chrome/content/zotero/xpcom/attachments.js b/chrome/content/zotero/xpcom/attachments.js index 6cc9ad33a1..e2e09b99e3 100644 --- a/chrome/content/zotero/xpcom/attachments.js +++ b/chrome/content/zotero/xpcom/attachments.js @@ -2479,8 +2479,9 @@ Zotero.Attachments = new function () { this.isRenameAllowedForType = function (contentType) { let typePrefixes; try { - typePrefixes = (Zotero.Prefs.get('autoRenameFiles.fileTypes') || '') - .split(','); + let prefValue = Zotero.Prefs.get('autoRenameFiles.fileTypes'); + if (!prefValue) return false; + typePrefixes = prefValue.split(','); } catch (e) { typePrefixes = [];