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