In the Path to custom logo or Path to custom icon fields under admin/appearance/settings/[themeName], Drupal rejects valid paths that happen to begin with a slash (/). It gives this error: The custom logo path is invalid.
This is unintuitive because it contravenes a common way of constructing relative URLs--to start them with a slash.
Valid relative URLs should not be rejected as that makes this product unfriendly to web developers.
| Comment | File | Size | Author |
|---|---|---|---|
| #6 | custom-logo-1798528-6.patch | 910 bytes | royal121 |
| #5 | custom-logo-1798528-5.patch | 898 bytes | royal121 |
| #2 | path-to-custom-logo-1798528.patch | 865 bytes | Anonymous (not verified) |
Comments
Comment #1
naxoc commentedUrls starting with a slash are relative to the root of the running script. What drupal is looking for in case of the logo path is the "absolute" path from the root. Maybe the description under the textfield where the path is input should simply mention "dont start the path with a slash"
Comment #2
Anonymous (not verified) commentedHere's a quick patch to update the description. I mimicked the description from the file system admin area to maintain consistency.
Comment #3
Anonymous (not verified) commentedComment #4
Rchenko commentedHi, I just updated to drupal 7.24 and got this bug. I tried this patch and it did not work. Any ideas?
I did not use git because that is another whole can of worms. I simply replaced this line:
'#description' => t('The path to the file you would like to use as your logo file instead of the default logo.'),
with this line:
'#description' => t('The path to the file you would like to use as your logo file instead of the default logo. This path must be relative to the Drupal installation directory and be accessible over the web.'),
in the code. I know that this is not the "best" way to do this but I just want to move on with my life. Any insight would be much appreciated!
Comment #5
royal121 commentedI have added an example in the description. Here is the patch.
Comment #6
royal121 commentedEdited a bit of formatting.
Comment #7
mimes commentedPatch posted in comment #6 is usable.
Comment #8
bill.zero commentedSorry to bring this up after 5 years, but the problem ID'd in the issue title is still at play as of drupal 7.60.
The previous comments on this issue have addressed it as a documentation issue rather than a path issue. I disagree. If, as previous commenters have stated, the field expects a path relative to the drupal root (and therefore an initial slash is not necessary), then my "Page not found" errors log would not be littered with entries like ...
[relative.path]/[path/and.file.name.of.custom.icon.png]
... with the [relative.path] being whatever relative url the user clicked into when my custom icon tried to load.
If the expectation is that the field expects a path relative to the root, it should act like that and stop prepending other relative paths in front of it. Alternatively, the field should allow an initial slash so that the server knows to work from the web root.
Comment #9
bill.zero commentedComment #10
bill.zero commentedIf it matters, I'm using the Zen 7.x-5.6 theme.
Comment #12
bill.zero commentedWorkround: I'm using a RedirectMatch in my .htaccess to try to keep the "page not found" errors out of the log:
RedirectMatch 301 .*iconfilename.png https://example.com/directoryname/iconfilename.pngIt seems to be working. I'm not great with regex.