FORMS-26813: Show custom acceptMessage for unsupported file type in File Attachment - #1940
Merged
Merged
Conversation
…ported file type The File Attachment (fileinput) widget's invalidMessage() looked up the custom unsupported-file-type message under constraintMessages.invalidMimeType, which is not a real constraint key. The authorable key is `accept` (ConstraintType.ACCEPT), backed by the acceptMessage dialog property, so the custom message was always undefined and a generic fallback was shown. The maxFileSize custom message worked because it already uses the correct key. Fix: read constraintMessages.accept for the MIMETYPE case, in both the ui.frontend source (FormFileInputWidgetBase.js) and the v4 clientlib copy (fileinputwidget.js). Backport of master PR #1928 to release/650. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…ed file type Adds the extra Cypress coverage from #1928, adapted to release/650: upload an unsupported-type file (sample.svg) to fileinput3 (accept=[application/pdf], now with an acceptMessage) and assert the alert equals constraintMessages.accept. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Test failures are pre-existing in project, unrelated to changes in this PR. |
mayankjindalmj
pushed a commit
that referenced
this pull request
Aug 3, 2026
…nsupported-type test Point the accept test at fileinput3 (accept=[application/pdf]) and upload sample.svg (an image, unsupported there) instead of populating a sample.afe placeholder. svg is non-empty so it passes the empty-file check and reaches the mime-type (accept) check. Matches the release/650 backport (#1940). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
mayankjindalmj
added a commit
that referenced
this pull request
Aug 4, 2026
…File Attachment (#1943) * Fix custom accept error message not shown for unsupported file type in file input The file-input widget's invalidMessage() looked up constraintMessages.invalidMimeType for the unsupported-file-type alert, but invalidMimeType is not an authorable constraint message key - the schema only exposes constraintMessages.accept (backed by the acceptMessage dialog property). As a result the custom message authors configure for file type validation was always ignored in favor of the generic fallback string, while the analogous maxFileSize custom message worked correctly since its key matched. Updated both the webpack source (ui.frontend) and the apps clientlib copy (ui.af.apps) to read constraintMessages.accept, and added a Cypress assertion mirroring the existing maxFileSize custom-message test. * FORMS-26813 : populate sample.afe fixture so the unsupported-type test reaches the mime-type (accept) check instead of the empty-file check Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> * FORMS-26813 : use existing sample.svg fixture on fileinput3 for the unsupported-type test Point the accept test at fileinput3 (accept=[application/pdf]) and upload sample.svg (an image, unsupported there) instead of populating a sample.afe placeholder. svg is non-empty so it passes the empty-file check and reaches the mime-type (accept) check. Matches the release/650 backport (#1940). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> --------- Co-authored-by: Farha Haroon <fharoon@adobe.com> Co-authored-by: Mayank Jindal <mayankjindal@adobe.com> Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.
Backport #1928
The File Attachment (fileinput) widget's invalidMessage() looked up the custom unsupported-file-type message under constraintMessages.invalidMimeType, which is not a real constraint key. The authorable key is
accept(ConstraintType.ACCEPT), backed by the acceptMessage dialog property, so the custom message was always undefined and a generic fallback was shown. The maxFileSize custom message worked because it already uses the correct key.Fix: read constraintMessages.accept for the MIMETYPE case, in both the ui.frontend source (FormFileInputWidgetBase.js) and the v4 clientlib copy (fileinputwidget.js). Backport of master PR #1928 to release/650.
Description
Related Issue
Motivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: