From 56eb77b704bdd35f896993174f45113e067d6802 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Tue, 25 Aug 2026 14:04:09 -0400 Subject: [PATCH] Fix dragging attachments to File Explorer Firefox 140.14 in Zotero 10.0 made the drag transferable's data principal null for chrome-initiated drags, so the file-promise stream that File Explorer used couldn't be created and the drop failed with "Unspecified error". On Windows the promise was just a file:// URL for the attachment itself, so hand over the file directly instead, and force a copy so that File Explorer doesn't move it out of storage. https://forums.zotero.org/discussion/133399/ https://bugzilla.mozilla.org/show_bug.cgi?id=2054665 --- chrome/content/zotero/xpcom/utilities_internal.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities_internal.js b/chrome/content/zotero/xpcom/utilities_internal.js index b4e187645b..0238aada06 100644 --- a/chrome/content/zotero/xpcom/utilities_internal.js +++ b/chrome/content/zotero/xpcom/utilities_internal.js @@ -3275,11 +3275,10 @@ Zotero.Utilities.Internal.onDragItems = function (event, itemIDs, dragImage = ev event.dataTransfer.mozSetDataAt("application/x-moz-file-promise", dataProvider, i); } - // Allow dragging to filesystem on Linux and Windows - let uri; - if (!Zotero.isMac) { + // Allow dragging to filesystem on Linux + if (Zotero.isLinux) { Zotero.debug("Adding text/x-moz-url " + i); - uri = Zotero.File.pathToFileURI(file); + let uri = Zotero.File.pathToFileURI(file); event.dataTransfer.mozSetDataAt("text/x-moz-url", uri + '\n' + file.leafName, i); } @@ -3287,11 +3286,8 @@ Zotero.Utilities.Internal.onDragItems = function (event, itemIDs, dragImage = ev Zotero.debug("Adding application/x-moz-file " + i); event.dataTransfer.mozSetDataAt("application/x-moz-file", file, i); - if (Zotero.isWin) { - event.dataTransfer.mozSetDataAt("application/x-moz-file-promise-url", uri, i); - } - else if (Zotero.isLinux) { - // Don't create a symlink for an unmodified drag + if (Zotero.isWin || Zotero.isLinux) { + // Copy rather than move (Windows) or symlink (Linux) for an unmodified drag event.dataTransfer.effectAllowed = 'copy'; } }