Cutting off /edit for media path breaks entity detection

Created on 20 June 2020, about 5 years ago
Updated 29 March 2023, over 2 years ago

More problems following #3063393: Remove '/edit' from media entity paths β†’ .

Apparently that changes causes the link to no longer be identified as an entity route, which in turn breaks entity link detection of entity_usage and our integration test failed on that.

As a start, this just reverts that feature. we'll use that for now, but should at least also have explicit test coverage and once we have that, could try to make it work with that.

πŸ› Bug report
Status

Needs work

Version

6.0

Component

Code

Created by

πŸ‡¨πŸ‡­Switzerland berdir Switzerland

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

    Just noting Wim's comment in the related issue in Drupal core ( https://www.drupal.org/project/drupal/issues/3317769#comment-14989414%2351 ✨ Drastically improve Drupal's default linking experience in text fields Needs work ):

    rather than
    pretending to link to /media/3/edit, which is blatantly wrong, I'm now
    generating an /entity URI/ instead: entity:media/3. That's not familiar for
    the end user, but it's equally recognizable, it just doesn't set the wrong
    expectations. So it's IMHO a net improvement.

  • πŸ‡ΊπŸ‡ΈUnited States bvoynick

    Here's an alternative workaround that adds media-specific logic to LinkitHelper::getEntityFromUserInput rather than revert the change to the saved URL.

    Like the reversion patches, this too is probably not the approach the module should take long term, but it will help work around this problem on sites with the canonical route turned off.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.1 & MySQL 8
    last update almost 2 years ago
    Composer require failure
  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson

    This is a solid short-term workaround in #7. I think this bug report is effectively a duplicate of where πŸ› Linkit filter does not replace internal node reference with alias Active has ended up.

    The longer-term solution is probably going to be along the lines of https://www.drupal.org/project/linkit/issues/3354873#comment-15209028 πŸ› Direct URL to media file entity does not work because relative URL does not pass URL path validation Fixed . If you agree and would like to help with finalizing that work, the community would appreciate it!

  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson
  • πŸ‡ΊπŸ‡ΈUnited States mark_fullmer Tucson
  • Merge request !111applied patch β†’ (Open) created by berdir
  • πŸ‡¨πŸ‡­Switzerland berdir Switzerland

    This still breaks entity usage and media detection, because /media/ID is not detected as a routed Url object in \Drupal\entity_usage\UrlToEntity::findEntityIdByRoutedUrl.

    #7 won't help with that, #6 would but that seems like a bigger change. FWIW, I don't really agree with the way Wim put it, "which is blatantly wrong". It's not wrong. media/ID/edit *is* the canonical link to a media in that case. We're not actually linking to media/ID either usually, so all 3 options really are quite confusing.

    I suppose for UX, the most sensible option would be some kind of managed UI like select2 but that's obviously complex and comes with its own accessibility issues.

    For now, just converted my previous patch in a MR.

  • Pipeline finished with Success
    6 days ago
    Total: 323s
    #533856
Production build 0.71.5 2024