Mendeley importer: Sniff for mime-type if octet-stream reported. #3454

This commit is contained in:
Tom Najdek 2024-04-05 12:57:10 +02:00
parent 4d05367f1d
commit b9de90c485
No known key found for this signature in database
GPG key ID: EEC61A7B4C667D77

View file

@ -1627,7 +1627,7 @@ Zotero_Import_Mendeley.prototype._saveAnnotations = async function (annotations,
if (file) {
// Fix blank PDF attachment MIME type from previous imports
let type = 'application/pdf';
if (!attachmentItem.attachmentContentType) {
if (!attachmentItem.attachmentContentType || attachmentItem.attachmentContentType === 'application/octet-stream') {
if (Zotero.MIME.sniffForMIMEType(await Zotero.File.getSample(file)) == type) {
attachmentItem.attachmentContentType = type;
await attachmentItem.saveTx(this._saveOptions);