Issue with approach checking canonical route with media entities
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3578379. --> Reported by: [ericgsmith](https://www.drupal.org/user/1649952) >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>I am evaluation this module as we have been using file_access_fix which is now marked as deprecated and points to this module as a replacement.</p> <p>I have configured track usage to track file entities with media as the source - this tracking is working as expected.</p> <p>However the file is never moved into the public system.</p> <p>It appears that when the FileVisibility service is calculating entity access (<a href="https://git.drupalcode.org/project/file_visibility/-/blob/1.x/src/FileVisibility.php?ref_type=heads#L271">https://git.drupalcode.org/project/file_visibility/-/blob/1.x/src/FileVisibility.php?ref_type=heads#L271</a>) it is trying to use the canonical url of the entity rather than the view permission. I am curious as to why?</p> <p>Media have a canoncial url - wit media's default configuration of <code>standalone_url: false</code> the canonical url is the edit screen and thus the edit permission is evaluation for the anonymous user rather than the view permission.</p> <h4 id="summary-steps-reproduce">Steps to reproduce</h4> <p>Standard install, enable tracking of files through an entity reference and source media. Add a document media entity as unpublished, publish the media and observe the file is in the private file system.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <h3 id="summary-remaining-tasks">Remaining tasks</h3> <h3 id="summary-ui-changes">User interface changes</h3> <h3 id="summary-api-changes">API changes</h3> <h3 id="summary-data-model-changes">Data model changes</h3> > Related issue: [Issue #3530284](https://www.drupal.org/node/3530284)
issue