Option to exclude files from the assets directory

Created on 21 April 2025, 25 days ago

Given the introduction of the option to have assets separate from the files directory , it would make sense for BAM to offer an "Exclude Files from Public Assets Directory" option, analogous to the existing "Exclude Files from Public Files Directory" option.

Feature request
Status

Active

Version

5.1

Component

Code

Created by

🇺🇸United States jdleonard Austin, TX, USA

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

Comments & Activities

  • Issue created by @jdleonard
  • 🇮🇳India sorabh.v6 Indore

    Working on it.

  • 🇮🇳India sorabh.v6 Indore

    sorabh.v6 changed the visibility of the branch 3520386-option-to-exclude-2 to hidden.

  • @sorabhv6 opened merge request.
  • 🇮🇳India sorabh.v6 Indore

    Code pushed to the MR. Please review.

    Thanks

  • 🇺🇸United States jdleonard Austin, TX, USA
  • 🇺🇸United States jdleonard Austin, TX, USA

    @sorabh.v6 thank you for getting this going!

    In DrupalFilesSourcePlugin::alterBackupMigrate, I attempted to fix the addition of default config for exclude_filepaths (which appeared to have a copy-paste typo and wasn't analogous for the three sources) though please double check that I didn't misinterpret the intent / behavior. Is exclude_private_filepaths (for example), correctly named? It's not clear to me under what circumstances it would ever be set and thus why it was added.

    I added an update hook to add the Assets Files source for existing sites. However, running it results in:

    TypeError: Symfony\Component\Console\Formatter\OutputFormatter::format(): Argument #1 ($message) must be of type ?string, array given

    I haven't been able to figure out why.

    I also added some relevant test assertions. Undoubtedly some additional tests would be wise. In particular, testing with and without a site's use of $settings['file_assets_path'] including pre-10.1 sites (for which the assets file stream does not exist).

    The update hook should probably also take into account whether the assets file stream exists to avoid creating a useless source. However, the source wouldn't then be created upon a site upgrading to 10.1. Not sure how to address this.

    I don't currently have time to pursue this further so unassigning.

  • 🇮🇳India sorabh.v6 Indore

    Hi @jdleonard,

    I attempted to fix the addition of default config for exclude_filepaths (which appeared to have a copy-paste typo and wasn't analogous for the three sources) though please double check that I didn't misinterpret the intent / behavior

    Thanks for spotting the typo.

    Is exclude_private_filepaths (for example), correctly named? It's not clear to me under what circumstances it would ever be set and thus why it was added.

    It was code refactor residue. I will remove it. Thanks for pointing it out.

    I haven't been able to figure out why.

    I will try to check.

  • 🇮🇳India sorabh.v6 Indore

    Update hook ran successfully when I switched from 5.0.3 to the issue branch.

  • 🇮🇳India sorabh.v6 Indore

    I have added code that checks if assets is a valid scheme or not to the DrupalFilesSourcePlugin.php class but I was not sure how do we achieve this for the update hook.

Production build 0.71.5 2024