Problem/Motivation
When syncing or embedding media assets from Acquia DAM, the module utilizes the asset's file name as a fallback string for the alt text attribute when an explicit alternative text is not provided.
Currently, this fallback includes the raw file extension (e.g., image-name.jpg or company-logo.png). It looks unpolished in the user interface if an image fails to load.
Steps to reproduce
- Configure and sync an image asset from Acquia DAM that does not have an explicitly defined metadata description or alternative text.
- Render the media asset in a Drupal view, field, or layout.
- Inspect the HTML markup.
- Expected result: The fallback
alttext uses a clean media name without a file extension (e.g.,alt="company-logo"). - Actual result: The fallback
alttext includes the raw file extension (e.g.,alt="company-logo.png").
Proposed resolution
Modify the media name fallback logic within the module to strip the file extension using a sanitization path helper or regular expression before setting it as the alt text fallback attribute.
| Comment | File | Size | Author |
|---|---|---|---|
| remove-file-extension-from-alt-text-fallback.patch | 1.79 KB | sudishth |
Issue fork acquia_dam-3582217
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #4
rajeshreeputraCreated MR for quick review and merge, code coverage will be added soon.
Comment #5
rajeshreeputraComment #7
rajeshreeputraMR merged!