diff --git a/app/stores/DocumentsStore.js b/app/stores/DocumentsStore.js index ae949211..ee6066e8 100644 --- a/app/stores/DocumentsStore.js +++ b/app/stores/DocumentsStore.js @@ -1,4 +1,5 @@ // @flow +import path from "path"; import invariant from "invariant"; import { find, orderBy, filter, compact, omitBy } from "lodash"; import { observable, action, computed, runInAction } from "mobx"; @@ -24,12 +25,13 @@ export default class DocumentsStore extends BaseStore { importFileTypes: string[] = [ ".md", + ".doc", + ".docx", "text/markdown", "text/plain", "text/html", "application/msword", "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "application/octet-stream", ]; constructor(rootStore: RootStore) { @@ -532,9 +534,14 @@ export default class DocumentsStore extends BaseStore { options: ImportOptions ) => { // file.type can be an empty string sometimes - if (file.type && !this.importFileTypes.includes(file.type)) { + if ( + file.type && + !this.importFileTypes.includes(file.type) && + !this.importFileTypes.includes(path.extname(file.name)) + ) { throw new Error(`The selected file type is not supported (${file.type})`); } + if (file.size > env.MAXIMUM_IMPORT_SIZE) { throw new Error("The selected file was too large to import"); }