fix bug where plaintext files were being posted to s3
This commit is contained in:
parent
8c270c2ced
commit
8aeb044509
2 changed files with 3 additions and 3 deletions
|
@ -1,6 +1,6 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import { createFile } from './files';
|
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 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';
|
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)) {
|
if (file.type.match(textFileRegex)) {
|
||||||
localIntercept(file).then(result => {
|
localIntercept(file).then(result => {
|
||||||
file.content = result; // eslint-disable-line
|
file.content = result; // eslint-disable-line
|
||||||
done();
|
done('Uploading plaintext file locally.');
|
||||||
})
|
})
|
||||||
.catch(result => {
|
.catch(result => {
|
||||||
done(`Failed to download file ${file.name}: ${result}`);
|
done(`Failed to download file ${file.name}: ${result}`);
|
||||||
|
|
|
@ -24,7 +24,7 @@ class FileUploader extends React.Component {
|
||||||
thumbnailWidth: 200,
|
thumbnailWidth: 200,
|
||||||
thumbnailHeight: 200,
|
thumbnailHeight: 200,
|
||||||
// TODO what is a good list of MIME types????
|
// 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',
|
dictDefaultMessage: 'Drop files here to upload or click to use the file browser',
|
||||||
accept: this.props.dropzoneAcceptCallback,
|
accept: this.props.dropzoneAcceptCallback,
|
||||||
sending: this.props.dropzoneSendingCallback,
|
sending: this.props.dropzoneSendingCallback,
|
||||||
|
|
Loading…
Reference in a new issue