mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2025-12-20 02:08:57 +00:00
Use MIME module
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
|
|
||||||
const dataURLToBlob = require('blueimp-canvas-to-blob');
|
const dataURLToBlob = require('blueimp-canvas-to-blob');
|
||||||
|
const MIME = require('./mime');
|
||||||
|
|
||||||
// // Fields
|
// // Fields
|
||||||
// {
|
// {
|
||||||
@@ -14,9 +15,6 @@ const dataURLToBlob = require('blueimp-canvas-to-blob');
|
|||||||
// data: ArrayBuffer
|
// data: ArrayBuffer
|
||||||
// }
|
// }
|
||||||
|
|
||||||
const isJPEG = mimeType =>
|
|
||||||
mimeType === 'image/jpeg' || mimeType === 'image/jpg';
|
|
||||||
|
|
||||||
// Data type conversion
|
// Data type conversion
|
||||||
const blobToArrayBuffer = blob =>
|
const blobToArrayBuffer = blob =>
|
||||||
new Promise((resolve, reject) => {
|
new Promise((resolve, reject) => {
|
||||||
@@ -45,7 +43,7 @@ const withLastNormalizedDate = attachment => Object.assign(
|
|||||||
);
|
);
|
||||||
|
|
||||||
const autoOrientJPEGs = async (attachment) => {
|
const autoOrientJPEGs = async (attachment) => {
|
||||||
if (!isJPEG(attachment.contentType)) {
|
if (!MIME.isJPEG(attachment.contentType)) {
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user