Private files links broken

Created on 14 December 2020, about 4 years ago
Updated 9 May 2024, 7 months ago

Hi guys,

We're trying to implement a "gated" private files access where files are only available to certain drupal roles.

Problem/Motivation

The problem:
When adding a LinkIt link to a private file the "href" link attribute is coming empty: <a data-entity-substitution="media" data-entity-type="media" data-entity-uuid="49b9dc4b-c888-438c-89af-3d1253fa6c9c" href="" title="Test">yet another private file</a>

Steps to reproduce

  1. Create a new "Private Files" media bundle with its field_media_file path set to the private files path (we're using Acquia BLT and the default private files location is at the "docroot" level called "files-private").
  2. Add the new "Private Files" media type to a LinkIt "Media" matcher and set the URL substitution to "Direct URL to media file entity".
  3. Create a media item using the new "Private Files" type (we're using PDF files).
  4. Create a basic page node.
  5. Add a LinkIt link to the newly created media item.
  6. Publish and save the node.
  7. View the LinkIt link source and verify the "href" attribute.

Proposed resolution

Users should be able to create LinkIt links to private files (with the private files path set outside the drupal root).

Implementation description:

  • Created a new "Private Files" media bundle with its field_media_file path set to the private files path. We are using Acquia BLT and the default private files location is at the "docroot" level called "files-private".
  • Added the new "Private Files" media type to the LinkIt "Media" matcher (we now have "File" and "Private Files") and set the URL substitution to "Direct URL to media file entity".

Worth mentioning that we're using the "Private files download permission" (private_files_download_permission) β†’ drupal contributed module to handle the access to the private files by roles.

Specs:
Drupal Version: 9.0.9
LinkIt Version: 6.0.0-beta1
Environment: Local LAMP on a Linux Ubuntu box

Many thanks for any help or insight!

Peace,
-Ivan

P.D. I wasn't sure if this was a bug or a feature request (sounds to me more like a feature request).

✨ Feature request
Status

Closed: won't fix

Version

5.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States netboss New Smyrna Beach, FL

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

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

    For some time now, as indicated by the Linkit project page β†’ , the 8.x-5.x branch of Linkit is not undergoing active development. It is also only compatible with unsupported versions of Drupal core (Drupal 8 and Drupal 9).

    To help the maintainers of the Linkit module better steward tasks under active development, I'm going to mark this issue as closed (wontfix). Sites using 8.x-5.x can certainly continue to do so, but should make plans for updating to the latest supported version of Linkit.

    Even better: Drupal core will soon provide link autocomplete suggestions in CKEditor similar to what this module does. Sites using or considering using Linkit should follow this core issue ✨ Drastically improve the linking experience in CKEditor 5 Needs work to evaluate whether they can use the core solution instead of Linkit. See feature differences below to compare what Linkit includes that will not initially be in Drupal core.

    If this issue relates to a problem or feature request that is applicable to the latest supported version of Linkit, please create a new issue, associated with that branch, describing the bug or enhancement.

    For participation and information in Linkit's roadmap, see 🌱 LinkIt Release Roadmap and Issue Prioritization Active .

    Thanks, community, for you collaboration and consideration!

Production build 0.71.5 2024