Repository navigation
Conversation
Author
|
Friendly ping — none of the workflows have run on the current head (
Could a maintainer approve the runs and take a look? The change reuses the existing per-file drop behaviour added in #15358 and only extends it to unsupported MIME types, so dropping Happy to rework the approach if you would rather handle it differently. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Dropping several files at once where one has an unsupported type rejects the entire selection:
validateFilesbails out withUnsupported file type: …on the first offender, so a drop ofphoto.png+notes.txt+setup.exeattaches nothing and the supported files have to be picked again one by one (reported with a recording in #16659). #15358 already made duplicates and oversized files drop out of a selection one by one while the rest uploads; unsupported types were left all-or-nothing. This change moves the per-file MIME check into that same partition step, so the supported files attach and a toast names the skipped ones: "Skipped unsupported file(s): setup.exe".Fixes #16659
How it works
partitionUploadsnow screens each file's type alongside duplicate and size: it infers the MIME type, re-types the file infileListin place exactly asvalidateFilesdoes, and skips files the allowlist rejects with a newunsupportedskip reason. The allowlist choice — the endpoint's own list, or the configured text/OCR/STT lists for context tool resources — moved into a sharedgetMimeTypesToCheckhelper so the partition and validation paths cannot drift, and bothprocessFilespartition calls (pre- and post-processing, the latter after HEIC conversion and resize) passfileConfigandtoolResourcethrough.validateFileskeeps its type loop unchanged: when the partition keeps nothing, the untouched selection still goes through the usual all-or-nothing checks and reports the pre-existing "Unsupported file type: …" error, and the loop remains the guard for callers that do not partition.Type of change
Testing
Tested environments/configuration:
Automated tests:
client/src/utils/__tests__/validateFiles.spec.ts: an unsupported file skipped while the files picked alongside it are kept, a fully unsupported selection, inference re-typing, an undeterminable type, and the context tool-resource allowlist.client/src/hooks/Files/__tests__/useFileHandling.test.ts: a batch ofphoto.png+setup.exeuploads the png and reportscom_error_files_skipped_unsupported, while a fully unsupported batch is still rejected in full with the pre-existing error and no skip notice.npx jest src/utils/__tests__/validateFiles.spec.ts src/hooks/Files/__tests__/useFileHandling.test.ts— 93 passing (32 + 61); the widersrc/hooks/Files+src/utilssuites pass except pre-existing locale-dependentformatCostexpectations intokens.spec.ts($vsUS$, unrelated to this change).Screenshots / recordings
No screenshot: no visual component changed. The only visible difference is the skip toast, which reuses the same error-toast mechanism as the existing duplicate and size skip notices ("Skipped duplicate file(s): …", "Skipped file(s) over the {{0}} MB size limit: …"), and the suites above assert the new
com_error_files_skipped_unsupportedkey.Risk / compatibility
Low. The only behavior change is on the upload-selection path (
processFiles), and only when a selection contains a file the endpoint cannot accept: previously everything was rejected, now the unsupported file is skipped and the rest uploads. A selection where nothing survives is still rejected in full with the same messages as before. Server-side validation is untouched — the client merely stops sending files the server would have rejected anyway.Checklist