Skip to content

Commit

Permalink
refactor(files): allow all mimetypes
Browse files Browse the repository at this point in the history
  • Loading branch information
derrabauke committed Jul 8, 2022
1 parent fa989c7 commit a501db5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion packages/form/addon/components/cf-field/input/file.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
name={{@field.pk}}
id={{@field.pk}}
disabled={{@disabled}}
accept={{this.allowedMimeTypes}}
multiple
{{on "change" this.save}}
/>
Expand Down
7 changes: 1 addition & 6 deletions packages/form/addon/components/cf-field/input/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,6 @@ export default class CfFieldInputFileComponent extends Component {
return this.args.field?.answer?.value;
}

get allowedMimeTypes() {
// TODO: put this into a config env value
return ["image/png", "image/jpeg", "text/plain", "application/pdf"];
}

@action
async download(fileName) {
if (!fileName) {
Expand All @@ -43,7 +38,7 @@ export default class CfFieldInputFileComponent extends Component {
@action
async save({ target }) {
// store the old list of files
const fileList = this.files?.length ? this.files.slice() : [];
const fileList = [...(this.files || [])];

// unwrap files from FileList construct
const newFiles = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module("Integration | Component | cf-field/input/file", function (hooks) {
raw: {
id: btoa("FilesAnswer:1"),
},
value: {},
value: null,
};
@tracked _errors = [];
})();
Expand Down

0 comments on commit a501db5

Please sign in to comment.