Hello!

After using the theme settings to upload a custom logo for the a theme, the path used to display the logo does not point to default/files/ but to the root of the install. I was able to upload a custom logo once, but never again.

Comments

bobodrone’s picture

Version: 7.0-alpha6 » 7.0-beta3
Status: Active » Needs review
StatusFileSize
new649 bytes

I found out that first of all it have not set the "file_public_path" (which set the current files directory in the variable table) when you install a clean Drupal 7 installation but most important of all the form where you upload the custom logo should return the filepath relative to default files folder instead of just the filename in the field where your logos filename is shown.

This patch solves this by prepend the "default files path" to the uploaded logo when it prints it to the custom logo field in the form.

bobodrone’s picture

Version: 7.0-beta3 » 7.x-dev

changed >>> 7.x-dev

bobodrone’s picture

Component: file system » system.module

and changed >>> system.module

Status: Needs review » Needs work

The last submitted patch, 901724#1_custom_logo.patch, failed testing.

bobodrone’s picture

Status: Needs work » Needs review
StatusFileSize
new649 bytes

Renamed my first core 7 patch, now I'm trying to follow the naming convention.
Sorry for that!
/ BoboDrone

mariusz.slonina’s picture

sub

bobodrone’s picture

Priority: Normal » Major

I think this bug is pretty serious since all logos will disappear the second time you post the theme settings form of any reason (if not have set file_public_path before manually)

Therefore I change this to major.

/ Bobodrone

dixon_’s picture

Assigned: Unassigned » dixon_

The Drupal 7 release party in Gothenburg by NodeOne will update, test and review this patch so we hopefully can mark this as RTBC tonight.

fabsor’s picture

StatusFileSize
new923 bytes

Hi!

The patch looks fine apart from that the trailing slash should not be in the default value, this way, the file public path is the same as in other places in core.

logaritmisk’s picture

I have tried the patch by fabsor and it works.

logaritmisk’s picture

Status: Needs review » Reviewed & tested by the community

Oups, forgot to change status :/

dixon_’s picture

Assigned: dixon_ » Unassigned
StatusFileSize
new874 bytes

Small offset. Re-rolled patch. Still works perfectly.

webchick’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

I would really love to see us add a test for this so it doesn't end up happening again.

naxoc’s picture

Status: Needs work » Needs review
StatusFileSize
new3.16 KB

Here is a test for that.

grndlvl’s picture

Confirmed system-admin-custom-logo-901724-12.patch fixes issue.

Confirmed 901724-14.patch(test case only) correctly detects issue before system-admin-custom-logo-901724-12.patch is applied and Passes successfully with system-admin-custom-logo-901724-12.patch applied.

Test seems to be sufficient for detecting this issue.

Status: Needs review » Needs work

The last submitted patch, 901724-14.patch, failed testing.

naxoc’s picture

Status: Needs work » Needs review

Weird. I can't make the test fail on my machine. Try again, bot!

naxoc’s picture

Issue tags: -Needs tests

#14: 901724-14.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs tests

The last submitted patch, 901724-14.patch, failed testing.

fabsor’s picture

Tests looks fine to me, and I can't reproduce this locally either. I will try to investigate further.

fabsor’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests

#14: 901724-14.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 901724-14.patch, failed testing.

naxoc’s picture

Status: Needs work » Needs review

#14: 901724-14.patch queued for re-testing.

Status: Needs review » Needs work
Issue tags: +Needs tests

The last submitted patch, 901724-14.patch, failed testing.

sun’s picture

Version: 7.x-dev » 8.x-dev
Issue tags: +Needs backport to D7
+++ b/modules/system/system.admin.inc
@@ -465,7 +465,7 @@ function system_theme_settings($form, &$form_state, $key = '') {
-      $logo_path = file_uri_target($logo_path);
+      $logo_path = variable_get('file_public_path', conf_path() . '/files') . '/' . file_uri_target($logo_path);

Seriously, don't we have an existing helper function for this...?

I really hope so, but I'm not very familiar with D7's File API yet.

Powered by Dreditor.

sun’s picture

pillarsdotnet’s picture

+      $logo_path = variable_get('file_public_path', conf_path() . '/files') . '/' . file_uri_target($logo_path);

Seriously, don't we have an existing helper function for this...?

How about $logo_path = drupal_realpath('public://') . '/' . file_uri_target($logo_path);

sun’s picture

catch’s picture

Status: Needs work » Needs review
StatusFileSize
new1.79 KB

#1376166: Custom logo and favicon functionality inanely tries to support absolute local file paths was committed to 8.x, and is in the process of being backported to 7.x.

I'm uploading just naxoc's test for this issue by itself, if that passes we can either combine the tests with the other issue, or if similar coverage was added elsewhere, just close this one.

Status: Needs review » Needs work

The last submitted patch, test_only.patch, failed testing.

naxoc’s picture

Status: Needs work » Closed (duplicate)