Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
/sites/sitename/files/custom_themes is symlinked to /sites/sitename/themes
In IMCE I have set sites/sitename/files/. as my imce directory.
When I click on custom_themes in imce it says
Directory "custom_themes" is not accessible under file system!
Other directories inside the files folder is accessible. The symlink and those directories have the same permissions and ownership. The /sites/sitename/themes directory has the same permissions and ownership as the other directories.
Is this kind of setup supported? If so where can I start looking?
Comments
Comment #1
ufku CreditAttribution: ufku commentedIMCE uses Drupal's directory path handling and it resolves paths in order to get the real path. This done to avoid directory exploits using paths like .././
Since your theme path is not under file directory, IMCE won't allow you to reach there.
FYI IMCE works fine with a file directory which is a symlink.
Comment #2
redndahead CreditAttribution: redndahead commentedwell there went that plan. On to plan b. Thanks.
Comment #4
pepeek CreditAttribution: pepeek commentedWhat is the plan B? Is there a solution/workarround for it?
Thanks,
--Josef
Comment #5
Bevan CreditAttribution: Bevan commentedUnfortunately moving the directory into the Drupal files directory is not an option for a project I am working on. Short of recursively hard-linking (then synchronising changes), are there other other workarounds, such as a configuration setting or a hack to the module?
(The security issue you describe is not an problem for this project as all users with access to the site are trusted. It's an intranet)
Thank you!
Comment #6
ufku CreditAttribution: ufku commentedThe function used for checking directory location is file_check_location(). You can either hack IMCE to use an alternate function or hack file_check_location() not to use realpath() that resolves symlinks. It's in includes/file.inc
Comment #7
Bevan CreditAttribution: Bevan commentedThanks ufku! (:
Comment #9
donquixote CreditAttribution: donquixote commentedHm, any idea how to do that in D7 ?
There is no file_check_location() in imce, just a lot of uri() stuff.
Comment #10
donquixote CreditAttribution: donquixote commentedThis one looks promising.
#1008402: Allow the use of symlinks within the files directory.
Comment #11
ufku CreditAttribution: ufku commentedSee #1008402: Allow the use of symlinks within the files directory.