Skip to content
This repository was archived by the owner on Jun 28, 2026. It is now read-only.

Commit 69ca79e

Browse files
authored
fix: file removal issue when selecting the same file twice (#7993)
* fix: prevent removal of same file when selecting it twice * refactor: format
1 parent 91c419c commit 69ca79e

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

components/lib/fileupload/FileUpload.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ export const FileUpload = React.memo(
125125

126126
for (let i = 0; i < selectedFiles.length; i++) {
127127
let file = selectedFiles[i];
128+
const shouldAddFile = props.multiple ? !isFileSelected(file) && validate(file) : validate(file);
128129

129-
if (!isFileSelected(file) && validate(file)) {
130+
if (shouldAddFile) {
130131
file.objectURL = window.URL.createObjectURL(file);
131132

132133
currentFiles.push(file);

0 commit comments

Comments
 (0)