mirror of
https://github.com/zotero/zotero.git
synced 2026-10-01 02:01:24 +00:00
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
This commit is contained in:
parent
e69ee69218
commit
56eb77b704
1 changed files with 5 additions and 9 deletions
|
|
@ -3275,11 +3275,10 @@ Zotero.Utilities.Internal.onDragItems = function (event, itemIDs, dragImage = ev
|
||||||
event.dataTransfer.mozSetDataAt("application/x-moz-file-promise", dataProvider, i);
|
event.dataTransfer.mozSetDataAt("application/x-moz-file-promise", dataProvider, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allow dragging to filesystem on Linux and Windows
|
// Allow dragging to filesystem on Linux
|
||||||
let uri;
|
if (Zotero.isLinux) {
|
||||||
if (!Zotero.isMac) {
|
|
||||||
Zotero.debug("Adding text/x-moz-url " + i);
|
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);
|
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);
|
Zotero.debug("Adding application/x-moz-file " + i);
|
||||||
event.dataTransfer.mozSetDataAt("application/x-moz-file", file, i);
|
event.dataTransfer.mozSetDataAt("application/x-moz-file", file, i);
|
||||||
|
|
||||||
if (Zotero.isWin) {
|
if (Zotero.isWin || Zotero.isLinux) {
|
||||||
event.dataTransfer.mozSetDataAt("application/x-moz-file-promise-url", uri, i);
|
// Copy rather than move (Windows) or symlink (Linux) for an unmodified drag
|
||||||
}
|
|
||||||
else if (Zotero.isLinux) {
|
|
||||||
// Don't create a symlink for an unmodified drag
|
|
||||||
event.dataTransfer.effectAllowed = 'copy';
|
event.dataTransfer.effectAllowed = 'copy';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue