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.

CommentFileSizeAuthor
#6 custom-logo-1798528-6.patch910 bytesroyal121
#5 custom-logo-1798528-5.patch898 bytesroyal121
#2 path-to-custom-logo-1798528.patch865 bytesAnonymous (not verified)

Comments

naxoc’s picture

Urls 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"

Anonymous’s picture

StatusFileSize
new865 bytes

Here's a quick patch to update the description. I mimicked the description from the file system admin area to maintain consistency.

Anonymous’s picture

Status: Active » Needs review
Rchenko’s picture

Hi, 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!

royal121’s picture

Version: 7.15 » 7.24
Issue summary: View changes
StatusFileSize
new898 bytes

I have added an example in the description. Here is the patch.

royal121’s picture

StatusFileSize
new910 bytes

Edited a bit of formatting.

mimes’s picture

Patch posted in comment #6 is usable.

bill.zero’s picture

Sorry 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.

bill.zero’s picture

Status: Needs review » Needs work
bill.zero’s picture

If it matters, I'm using the Zen 7.x-5.6 theme.

Version: 7.24 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

bill.zero’s picture

Workround: 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.png
It seems to be working. I'm not great with regex.

Status: Needs work » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.