Media with URL substitution type of Direct URL loosing match after multiple edits

Created on 16 December 2024, about 1 month ago

Problem/motivation

This issue is related to Show URL alias after autocomplete selection instead of internal route (e.g., /node/123) Needs work but feels like an separate problem to fix.

We got reports of editors that multiple edits of existing links to media entities with direct URL substitution (perhaps with canonical too), can easily end up loosing the relation metadata.

The problem seems to be combination of which string is stored as URL on the link, edits on the link combined with reconfirming the linked entity and having the media 'Standalone media URL' option disabled, and having inattentive editors.

I can't consistently reproduce the steps to the problem, but essential is to end up with '/media/[ID]' being added by the widget in the 'Link URL' autocomplete after (re-)selection.
Sometimes it takes multiple edits with re-selecting the desired media entity, sometimes it happens on the first try.

Clicking the 'Link URL' with a '/media/[ID]' value, will cause no results from the matcher, and you'll see only the 'no results' suggestion.
An unattentive editor may click the 'no result' suggestion and then the link is lost.

Steps to reproduce

  1. Have a profile setup that can match media entities with URL substitution 'Direct URL to media file entity' and having the media 'Standalone media URL' option disabled
  2. Add link to a text, find and select a media entity
  3. Save the entity you are editing
  4. Edit the link in the entity again
  5. If the 'Link URL' does not show a '/media/[ID]' value, click the field and select the desired media entity again from the suggestions
  6. Repeat from step 3 until you get '/media/[ID]' in the 'Link URL' field and clicking the field will result in no more matches

Proposed resolution

The saved URL and matching behaviour should be consistent, no matter how many times you edit and resave the selected media entity.

As a (temporary) workaround for cases experiencing the same problem, find patch attached to handle the matching with '/media/[ID]' so the 'no results' will not appear.

🐛 Bug report
Status

Active

Version

7.0

Component

Code

Created by

🇧🇪Belgium andreasderijcke Antwerpen / Gent

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024