Skip to content

Commit

Permalink
fix(input): fixed extensions not working when not specified (#83)
Browse files Browse the repository at this point in the history
fixes #82
  • Loading branch information
UncleDave committed Jun 30, 2017
1 parent 24ee042 commit 204ab16
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ package-lock.json
yarn.lock
src/tsconfig.json
.npmignore
.travis.yml
7 changes: 3 additions & 4 deletions src/image-upload/image-upload.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export class ImageUploadComponent implements OnInit {
@Input()
fileTooLargeMessage: string;
@Input('extensions')
supportedExtensions: string[] = ['image/*'];
supportedExtensions: string[];

private pendingFilesCounter: number = 0;
@ViewChild('input')
Expand All @@ -55,9 +55,8 @@ export class ImageUploadComponent implements OnInit {
if (!this.fileTooLargeMessage) {
this.fileTooLargeMessage = 'An image was too large and was not uploaded.' + (this.maxFileSize ? (' The maximum file size is ' + this.maxFileSize / 1024) + 'KiB.' : '');
}
if (this.supportedExtensions) {
this.supportedExtensions = this.supportedExtensions.map((ext) => 'image/' + ext);
}

this.supportedExtensions = this.supportedExtensions ? this.supportedExtensions.map((ext) => 'image/' + ext) : ['image/*'];
}

fileChange(files: FileList) {
Expand Down

0 comments on commit 204ab16

Please sign in to comment.