Skip to content

Commit

Permalink
add validation to set files
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilReinking committed Jul 11, 2024
1 parent d0224d5 commit c32fae1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions resources/js/forms/classic/interactions/FileAction.vue
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,14 @@ const setFiles = (files: File[] | FileList | null) => {
if (files) {
for (const file of files) {
// validate first if file type is allowed
// validate second that files names are unique
if (
currentFiles.every(
(currentFile) =>
currentFile.name !== file.name ||
currentFile.type !== file.type ||
currentFile.size !== file.size,
) &&
allowedFileTypes.value
.split(",")
.some(
Expand Down

0 comments on commit c32fae1

Please sign in to comment.