dxc-technology / halstack-react

Library of components for building SPAs with React and Halstack Design System
https://developer.dxc.com/halstack/
Apache License 2.0
15 stars 14 forks source link

Updates FileInput component logic to prevent duplicates #1762

Closed Mil4n0r closed 10 months ago

Mil4n0r commented 10 months ago

Checklist

Description This fixes the problem where, if we select the same file multiple times, it would stack instead of detecting it already was added. The testing was also updated in order to take this previously unrecorded scenario into account.

Additional context Differentiating between two files with the same name using the File API can be challenging because the API itself does not provide a unique identifier or file-specific information that distinguishes files solely based on their names. So I did a comparation of multiple parameters (name, size, lastModified...) in order to ensure that 2 files are equals.

Closes #1736