Skip to content
Commits on Source (2)
......@@ -2,6 +2,7 @@ import { observable, action, extendObservable } from 'mobx'
import { Platform, Alert } from 'react-native';
import rnFS from 'react-native-fs';
import MediaMeta from 'react-native-media-meta';
import fileType from 'react-native-file-type';
import attachmentService from '../services/attachment.service';
import {MINDS_MAX_VIDEO_LENGTH} from '../../config/Config';
......@@ -104,6 +105,13 @@ export default class AttachmentStore {
@action
async validate(media) {
if(!media.type){
const type = await fileType(media.path);
media.type = type.mime;
}
if(media.fileName.includes(' ')) media.fileName = media.fileName.replace(/\s/g, "_");
const settings = await mindsService.getSettings();
let videoPath = null;
......
......@@ -1873,6 +1873,14 @@ buffer-xor@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9"
buffer@5.0.8:
version "5.0.8"
resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.0.8.tgz#84daa52e7cf2fa8ce4195bc5cf0f7809e0930b24"
integrity sha512-xXvjQhVNz50v2nPeoOsNqWCLGfiv4ji/gXZM28jnVwdLJxH4mFyqgqCKfaK9zf1KUbG6zTkjLOy7ou+jSMarGA==
dependencies:
base64-js "^1.0.2"
ieee754 "^1.1.4"
buffer@^3.0.1:
version "3.6.0"
resolved "http://registry.npmjs.org/buffer/-/buffer-3.6.0.tgz#a72c936f77b96bf52f5f7e7b467180628551defb"
......@@ -3310,6 +3318,11 @@ figures@^2.0.0:
dependencies:
escape-string-regexp "^1.0.5"
file-type@7.3.0:
version "7.3.0"
resolved "https://registry.yarnpkg.com/file-type/-/file-type-7.3.0.tgz#18869760e10c36c0416d53083684fcfc0d59df3a"
integrity sha1-GIaXYOEMNsBBbVMINoT8/A1Z3zo=
file-type@^3.8.0:
version "3.9.0"
resolved "https://registry.yarnpkg.com/file-type/-/file-type-3.9.0.tgz#257a078384d1db8087bc449d107d52a52672b9e9"
......@@ -4885,6 +4898,11 @@ jest@24.1.0:
import-local "^2.0.0"
jest-cli "^24.1.0"
js-base64@2.3.2:
version "2.3.2"
resolved "https://registry.yarnpkg.com/js-base64/-/js-base64-2.3.2.tgz#a79a923666372b580f8e27f51845c6f7e8fbfbaf"
integrity sha512-Y2/+DnfJJXT1/FCwUebUhLWb3QihxiSC42+ctHLGogmW2jPY6LCapMdFZXRvVP2z6qyKW7s6qncE/9gSqZiArw==
js-sha3@0.5.5:
version "0.5.5"
resolved "https://registry.yarnpkg.com/js-sha3/-/js-sha3-0.5.5.tgz#baf0c0e8c54ad5903447df96ade7a4a1bca79a4a"
......@@ -7170,6 +7188,16 @@ react-native-fast-image@^5.4.2:
resolved "https://registry.yarnpkg.com/react-native-fast-image/-/react-native-fast-image-5.4.2.tgz#d761cb9dddc0473b537544617e511a11c9e18413"
integrity sha512-S4E96Lwmx6z6QD3MaAuP7cNcXRLfgEUYU2GB694TbGEoOjk/FO1OnfbxfFp0vUs/klr4HJwACcwihPPxrFTt8w==
react-native-file-type@^0.0.8:
version "0.0.8"
resolved "https://registry.yarnpkg.com/react-native-file-type/-/react-native-file-type-0.0.8.tgz#1f9d9b43bb81e2e02d13a7ee6798b40b7f83353e"
integrity sha512-SBVBhtoK4uxxAgIHaO4gnyryOM9lkq+JbLaKYOFnnfFkInds8PGca1rCn3QbpbkPrnuLnrFzG3bsKsGJFp1PHw==
dependencies:
buffer "5.0.8"
file-type "7.3.0"
js-base64 "2.3.2"
react-native-fs "2.11.15"
react-native-flash-message@^0.1.13:
version "0.1.13"
resolved "https://registry.yarnpkg.com/react-native-flash-message/-/react-native-flash-message-0.1.13.tgz#3ebf9cf17d5aabc61b923dc6dc37ce97a1ad4dd2"
......@@ -7178,6 +7206,14 @@ react-native-flash-message@^0.1.13:
prop-types "^15.7.2"
react-native-iphone-x-helper "^1.2.0"
react-native-fs@2.11.15:
version "2.11.15"
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.11.15.tgz#b80ac78edf124137624697b4864f834c1caf4f43"
integrity sha512-JDcpYOBYWHHZqaqxG9c17uGapTQQLvVic0GewQWxhad3ftPVodBQ6qMZxyR1h6U8SN2eaJhFqAfenUKl1UtVJg==
dependencies:
base-64 "^0.1.0"
utf8 "^2.1.1"
react-native-fs@^2.13.3:
version "2.13.3"
resolved "https://registry.yarnpkg.com/react-native-fs/-/react-native-fs-2.13.3.tgz#a422f0ecd8a093a7e99d8d51ff51440e090a18a8"
......