Fix the bug
This commit is contained in:
parent
1a4f49719d
commit
e4ffdd9e54
2 changed files with 2 additions and 4 deletions
|
|
@ -53,7 +53,7 @@ export class FileHandle {
|
|||
*/
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
_getFileNameExtension(fileName) {
|
||||
return fileName.slice(fileName.lastIndexOf('.') + 1);
|
||||
return fileName.slice(fileName.lastIndexOf('.'));
|
||||
}
|
||||
|
||||
// TODO: seems to suggest upload is going on...
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ export class LionInputFile extends ScopedElementsMixin(LocalizeMixin(LionField))
|
|||
/** @type {string[]} */
|
||||
let allowedFileExtensions = [];
|
||||
if (this.accept) {
|
||||
const acceptedFiles = this.accept.replace(/\s+/g, '').replace(/\.+/g, '').split(',');
|
||||
const acceptedFiles = this.accept.replace(/\s+/g, '').split(',');
|
||||
allowedFileTypes = acceptedFiles.filter(acceptedFile => acceptedFile.includes('/'));
|
||||
allowedFileExtensions = acceptedFiles.filter(acceptedFile => !acceptedFile.includes('/'));
|
||||
}
|
||||
|
|
@ -692,8 +692,6 @@ export class LionInputFile extends ScopedElementsMixin(LocalizeMixin(LionField))
|
|||
|
||||
if (allowedFileExtensions.length) {
|
||||
array = allowedFileExtensions;
|
||||
// eslint-disable-next-line no-return-assign
|
||||
array = array.map(item => (item = `.${item}`));
|
||||
lastItem = array.pop();
|
||||
arrayLength = array.length;
|
||||
} else if (allowedFileTypes.length) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue