1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +01:00

Add variety of supported file formats & fix bug when parsing mime type

This commit is contained in:
Tim Daubenschütz 2015-11-18 17:55:27 +01:00
parent 43c6ee929b
commit 399f670bed
2 changed files with 11 additions and 4 deletions

View File

@ -87,10 +87,10 @@ let RegisterPieceForm = React.createClass({
const validFiles = files.filter(displayValidFilesFilter); const validFiles = files.filter(displayValidFilesFilter);
if(validFiles.length > 0) { if(validFiles.length > 0) {
const { type: fileType } = validFiles[0].type; const { type: mimeType } = validFiles[0];
const fileExtension = fileType && fileType.split('/').length ? fileType.split('/')[1] const mimeSubType = mimeType && mimeType.split('/').length ? mimeType.split('/')[1]
: 'unknown'; : 'unknown';
const thumbnailKeyDialogExpanded = AppConstants.supportedThumbnailFileFormats.indexOf(fileExtension) === -1; const thumbnailKeyDialogExpanded = AppConstants.supportedThumbnailFileFormats.indexOf(mimeSubType) === -1;
this.setState({ thumbnailKeyDialogExpanded }); this.setState({ thumbnailKeyDialogExpanded });
} else { } else {
this.setState({ thumbnailKeyDialogExpanded: false }); this.setState({ thumbnailKeyDialogExpanded: false });

View File

@ -88,7 +88,14 @@ const constants = {
'searchThreshold': 500, 'searchThreshold': 500,
'supportedThumbnailFileFormats': ['png', 'jpg', 'jpeg', 'gif', 'mp4'], 'supportedThumbnailFileFormats': [
'x-sgi-movie', 'x-msvideo', 'quicktime', 'mpeg', 'png', 'jpeg', 'gif',
'ogg', 'oga', 'ogv', 'ogx', 'wmv', 'wma', 'flv', '3gpp2', '3p2', '3pg',
'png', 'jpg', 'jpeg', 'gif', '264', '3g', '3g2', '3gp', '3gp2', '3gpp',
'mp4', 'm4a', 'm4v', 'f4v', 'f4a', 'm4b', 'm4r', 'f4b', 'mov', 'quicktime',
'webm', 'x264', 'mpeg', 'mpeg4', 'mpg4', 'bmp', 'eps', 'jp2', 'j2k', 'jpm',
'mj2'
],
// in case of whitelabel customization, we store stuff here // in case of whitelabel customization, we store stuff here
'whitelabel': {}, 'whitelabel': {},