fix bug where plaintext files were being posted to s3

This commit is contained in:
Cassie Tarakajian 2016-10-24 16:33:16 -04:00
parent 8c270c2ced
commit 8aeb044509
2 changed files with 3 additions and 3 deletions

View file

@ -1,6 +1,6 @@
import axios from 'axios';
import { createFile } from './files';
const textFileRegex = /text\//;
const textFileRegex = /(text\/|application\/json)/;
const s3BucketHttps = `https://s3-us-west-2.amazonaws.com/${process.env.S3_BUCKET}/`;
const ROOT_URL = location.href.indexOf('localhost') > 0 ? 'http://localhost:8000/api' : '/api';
@ -38,7 +38,7 @@ export function dropzoneAcceptCallback(file, done) {
if (file.type.match(textFileRegex)) {
localIntercept(file).then(result => {
file.content = result; // eslint-disable-line
done();
done('Uploading plaintext file locally.');
})
.catch(result => {
done(`Failed to download file ${file.name}: ${result}`);

View file

@ -24,7 +24,7 @@ class FileUploader extends React.Component {
thumbnailWidth: 200,
thumbnailHeight: 200,
// TODO what is a good list of MIME types????
acceptedFiles: 'image/*,audio/*,text/javascript,text/html,text/css,application/json,application/x-font-ttf,application/x-font-truetype',
acceptedFiles: 'image/*,audio/*,text/javascript,text/html,text/css,application/json,application/x-font-ttf,application/x-font-truetype,text/plain',
dictDefaultMessage: 'Drop files here to upload or click to use the file browser',
accept: this.props.dropzoneAcceptCallback,
sending: this.props.dropzoneSendingCallback,