mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Skip autoOrientImage for non-JPEG images
This commit is contained in:
@@ -6,6 +6,8 @@
|
||||
'use strict';
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
const { MIME } = window.Signal.Types;
|
||||
|
||||
Whisper.FileSizeToast = Whisper.ToastView.extend({
|
||||
templateName: 'file-size-modal',
|
||||
render_attributes: function() {
|
||||
@@ -31,6 +33,7 @@
|
||||
this.thumb = new Whisper.AttachmentPreviewView();
|
||||
this.$el.addClass('file-input');
|
||||
this.window = options.window;
|
||||
this.previewObjectUrl = null;
|
||||
},
|
||||
|
||||
events: {
|
||||
@@ -136,6 +139,12 @@
|
||||
case 'audio': this.addThumb('images/audio.svg'); break;
|
||||
case 'video': this.addThumb('images/video.svg'); break;
|
||||
case 'image':
|
||||
if (!MIME.isJPEG(file.type)) {
|
||||
this.previewObjectUrl = URL.createObjectURL(file);
|
||||
this.addThumb(this.previewObjectUrl);
|
||||
break;
|
||||
}
|
||||
|
||||
window.autoOrientImage(file)
|
||||
.then(dataURL => this.addThumb(dataURL));
|
||||
break;
|
||||
@@ -271,6 +280,11 @@
|
||||
},
|
||||
|
||||
clearForm: function() {
|
||||
if (this.previewObjectUrl) {
|
||||
URL.revokeObjectURL(this.previewObjectUrl);
|
||||
this.previewObjectUrl = null;
|
||||
}
|
||||
|
||||
this.thumb.remove();
|
||||
this.$('.avatar').show();
|
||||
this.$el.trigger('force-resize');
|
||||
|
||||
@@ -80,6 +80,7 @@
|
||||
window.Signal.Types = window.Signal.Types || {};
|
||||
window.Signal.Types.Attachment = require('./js/modules/types/attachment');
|
||||
window.Signal.Types.Message = require('./js/modules/types/message');
|
||||
window.Signal.Types.MIME = require('./js/modules/types/mime');
|
||||
|
||||
// We pull this in last, because the native module involved appears to be sensitive to
|
||||
// /tmp mounted as noexec on Linux.
|
||||
|
||||
Reference in New Issue
Block a user