Skip to content

Commit de76f55

Browse files
committed
fix gif
1 parent cd301d5 commit de76f55

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

browser/main/lib/dataApi/attachmentManagement.js

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -278,15 +278,23 @@ function handleAttachmentDrop (codeEditor, storageKey, noteKey, dropEvent) {
278278
let promise
279279
if (dropEvent.dataTransfer.files.length > 0) {
280280
promise = Promise.all(Array.from(dropEvent.dataTransfer.files).map(file => {
281-
if (file['type'].startsWith('image') && !file['type'].endsWith('gif')) {
282-
return fixRotate(file)
283-
.then(data => copyAttachment({type: 'base64', data: data, sourceFilePath: file.path}, storageKey, noteKey)
284-
.then(fileName => ({
285-
fileName,
286-
title: path.basename(file.path),
287-
isImage: true
288-
}))
289-
)
281+
if (file.type.startsWith('image')) {
282+
if (file.type.endsWith('gif')) {
283+
return copyAttachment(file.path, storageKey, noteKey).then(fileName => ({
284+
fileName,
285+
title: path.basename(file.path),
286+
isImage: true
287+
}))
288+
} else {
289+
return fixRotate(file)
290+
.then(data => copyAttachment({type: 'base64', data: data, sourceFilePath: file.path}, storageKey, noteKey)
291+
.then(fileName => ({
292+
fileName,
293+
title: path.basename(file.path),
294+
isImage: true
295+
}))
296+
)
297+
}
290298
} else {
291299
return copyAttachment(file.path, storageKey, noteKey).then(fileName => ({
292300
fileName,

0 commit comments

Comments
 (0)