Skip to content

fix(ui-file-input): validate every selected file size - #2403

Open
pcbeingused333 wants to merge 1 commit into
FlowFuse:mainfrom
pcbeingused333:fix/file-input-validate-all-c5878
Open

pcbeingused333 wants to merge 1 commit into
FlowFuse:mainfrom
pcbeingused333:fix/file-input-validate-all-c5878

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Selecting a 200-byte file followed by a 6000-byte file with a 5000-byte limit disables Upload without displaying the size error. The button checks every selected file, but the validation rule checks only the first.

Use the same size check for the button and the validation rule, and show the configured maximum when any selected file exceeds it. A file exactly at the limit could already be uploaded but was flagged by the rule (size < maxSize); it is no longer flagged, and the message now reads "at most" to match.

The repository has no unit tests for .vue widgets, so no test file is added. The change was checked with a standalone Node.js script that loads the component's script block and calls canUpload and the maxFileSize rule for six selections with a 5000-byte limit: an oversized second file, an oversized first file, two files below the limit, a file at the limit, a single oversized file, and an empty selection. Three cases failed on main (oversized second file, file at the limit, single non-array file) and all six pass with the fix.

This change was prepared with AI assistance.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant