mirror of
https://github.com/zotero/zotero.git
synced 2026-08-28 05:25:31 +00:00
Fix race between lastRead update and content-type fix on file open
Some checks are pending
Some checks are pending
viewAttachment() fired the 'open' notification before launchFile() saved a sniffed content type, so AttachmentReadObserver's concurrent lastRead save could reload the item and discard the pending change, leaving the attachment with a blank or incorrect content type.
This commit is contained in:
parent
bdea584a17
commit
0ba89211ce
1 changed files with 8 additions and 2 deletions
|
|
@ -5624,8 +5624,11 @@ var ZoteroPane = new function () {
|
|||
|
||||
if (fileExists && !redownload) {
|
||||
Zotero.debug("Opening " + path);
|
||||
Zotero.Notifier.trigger('open', 'file', item.id);
|
||||
await launchFile(path, item);
|
||||
// Trigger after launchFile(), which may save a content-type fix
|
||||
// to the item -- 'open' observers save changes to the item
|
||||
// (e.g., lastRead), which could discard an in-flight change
|
||||
Zotero.Notifier.trigger('open', 'file', item.id);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -5670,8 +5673,11 @@ var ZoteroPane = new function () {
|
|||
Zotero.Notifier.trigger('redraw', 'item', []);
|
||||
|
||||
Zotero.debug("Opening " + path);
|
||||
Zotero.Notifier.trigger('open', 'file', item.id);
|
||||
await launchFile(path, item);
|
||||
// Trigger after launchFile(), which may save a content-type fix
|
||||
// to the item -- 'open' observers save changes to the item
|
||||
// (e.g., lastRead), which could discard an in-flight change
|
||||
Zotero.Notifier.trigger('open', 'file', item.id);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue