Can this module handle multiple files directories on one site?

Created on 5 June 2014, about 10 years ago
Updated 10 June 2023, about 1 year ago

I've run into a strange issue with this module, and I'm not sure what the best way to approach it is. The basic problem is that a client I'm working with includes files from sites/default/files on their multisite, which isn't playing well with Stage File Proxy.

For example let's call the multisite's files directory sites/multiste/files. On a page, there are references to sites/default/files/my_image.jpg and sites/multiste/files/another_image.jpg. stage_file_proxy_origin_dir is set to "sites/multiste/files".

When the page is loaded, stage_file_proxy_init is called for each file. sites/default/files/my_image.jpg is not downloaded as the public files path for this multisite is sites/multiste/files. If I change stage_file_proxy_origin_dir to sites/default/files, sites/multiste/files/another_image.jpg will not be loaded.

It would make sense to me to then set the stage_file_proxy_origin_dir to "sites", as both files paths are subdirectories of sites. Sadly, if I did that this still wouldn't work since stage_file_proxy_init checks the request URL against the Drupal public files path, which again would be sites/multiste/files in this case. I have a patch that changes stage_file_proxy_init to always check against $remote_file_dir, not $file_dir, which worked in correlation with setting stage_file_proxy_origin_dir to "sites" (I've attached that patch). That said, this does not seem like a super ideal solution as there are Drupal installations with things that aren't files in the sites directory. Another solution that would take a bit more leg-work is letting the module support multiple stage_file_proxy_origin_dirs, where stage_file_proxy_origin_dir could be a path or an array of paths. Not sure how that would be best implemented either.

What's my best option for addressing this issue?

✨ Feature request
Status

Closed: outdated

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States samuel.mortenson

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 smustgrave

    Even though D7 has been extended to 2025, think it's unrealistic that modules will continue to support also. So closing out old D7 tickets. If anyone feels super strongly about adding to D7 please reopen but the D7 module will be relatively unmanned.

Production build 0.69.0 2024