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 alt text uses a clean media name without a file extension (e.g., alt="company-logo").
  • Actual result: The fallback alt text 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.

Issue fork acquia_dam-3582217

Command icon 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

sudishth created an issue. See original summary.

rajeshreeputra made their first commit to this issue’s fork.

rajeshreeputra’s picture

Assigned: Unassigned » rajeshreeputra

Created MR for quick review and merge, code coverage will be added soon.

rajeshreeputra’s picture

Issue summary: View changes

  • rajeshreeputra committed 6b295e50 on 1.1.x
    Resolve #3582217 "Remove file extension from media name used as alt text...
rajeshreeputra’s picture

Status: Needs review » Fixed

MR merged!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.