Skip to content

FORMS-26813: Show custom acceptMessage for unsupported file type in File Attachment - #1940

Merged
mayankjindalmj merged 2 commits into
release/650from
backport-pr-1928-release-650
Aug 4, 2026
Merged

FORMS-26813: Show custom acceptMessage for unsupported file type in File Attachment#1940
mayankjindalmj merged 2 commits into
release/650from
backport-pr-1928-release-650

Conversation

@mayankjindalmj

Copy link
Copy Markdown
Contributor

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have signed the Adobe Open Source CLA.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes and the overall coverage did not decrease.
  • All unit tests pass on CircleCi.
  • I ran all tests locally and they pass.

Mayank Jindal and others added 2 commits July 31, 2026 14:34
…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>
@mayankjindalmj

Copy link
Copy Markdown
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>
@mayankjindalmj
mayankjindalmj merged commit a5dead1 into release/650 Aug 4, 2026
7 of 10 checks passed
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