Problem/Motivation

I created the private file system as detailed in all the documentation. When I upload my custom logo file, it uploads to the private file directory correctly. However, I get an error message on my reports page....warning page not found. D7 doesn't seem to be able to find it. When I set the file system to public and upload my logo, it works.

I have tried this with just D7 installed and no contrib modules.

I am running this in a dev environment on my Mac OS 10.6.6 on Mamp Pro 1.9.4, Apache, Mysql 5.1.44, PHP 5.3.2

I have included screen shots.

Before screenshots

Steps to reproduce

  1. Create a private filepath outside of Drupal root
  2. Set the file path in settings.php
  3. Go to admin/config/media/file-system and select 'Private local files served by Drupal'
  4. Go to admin/appearance/settings/stark and upload a logo
  5. The configuration is saved, the path to the custom logo is display, 'private://your-logo'
  6. The logo is not displayed

Proposed resolution

Always use the public scheme for the logo.


Before screenshots



After screenshots


Remaining tasks

User interface changes

Yes

API changes

N/A

Data model changes

N/A

Release notes snippet

N/A

CommentFileSizeAuthor
#112 1087250-112.patch4.88 KB_utsavsharma
#112 interdiff_111-112.txt643 bytes_utsavsharma
#111 interdiff_104-111.txt4.26 KBg-brodiei
#111 1087250-111.patch4.88 KBg-brodiei
#107 1087250-107.patch3.79 KB_utsavsharma
#107 interdiff_106-107.txt3.05 KB_utsavsharma
#106 1087250-104-failtest.patch3.79 KBg-brodiei
#104 interdiff_92-104.txt3.69 KBg-brodiei
#104 1087250-104.patch3.94 KBg-brodiei
#95 after_file_system.png287.73 KBNitinLama
#95 after_logo_path.png99.76 KBNitinLama
#95 after_logo.png420.06 KBNitinLama
#95 before_path.png93.4 KBNitinLama
#95 before_logo.png317.76 KBNitinLama
#92 interdiff_89-92.txt581 bytesraman.b
#92 1087250-92.patch3.75 KBraman.b
#89 1087250-89.patch4.05 KBquietone
#89 1087250-89-fail.patch3.16 KBquietone
#89 interdiff.txt786 bytesquietone
#82 1087250-D8.8.x.logo-public.patch909 bytesdonaldp
#78 1087250-D8.7.1.logo-public.patch1.54 KBdonaldp
#76 1087250-D8.7.1.logo-public.patch1.54 KBdonaldp
#76 1087250-D8.7.1.logo-public.patch1.54 KBdonaldp
#75 1087250-d8.6.16-logo-public-filesystem.patch1.24 KBdonaldp
#70 1087250-logo-public-filesystem.patch1.24 KBdonaldp
#66 1087250.logo-public-filesystem.057-b.patch1.2 KBSocialNicheGuru
#57 1087250.logo-public-filesystem.057.patch1.2 KBShiraz Dindar
#48 1087250-logo-private-test.patch3.08 KBdawehner
#46 1087250-logo-private-test.patch3.2 KBdawehner
#44 1087250.logo-public-filesystem.044.patch1.18 KBkarschsp
#43 1087250.logo-public-filesystem.042.patch1.49 KBkarschsp
#19 logoimage_v2.patch1.22 KBdpolant
#16 logoimage.patch1.09 KBdpolant
#14 bartik_logo.jpg29.74 KBwebankit
#13 bartik_logo.jpg5.57 KBwebankit
Screen shot 2011-03-09 at 5.05.09 PM.png39.38 KBSeph
Screen shot 2011-03-09 at 5.04.28 PM.png79.54 KBSeph
Screen shot 2011-03-09 at 5.02.50 PM.png38.36 KBSeph
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Seph’s picture

Status: Active » Closed (duplicate)
SuperContraXTC’s picture

I am having the same issue
I am running Ubuntu, LAMP, Drupal 7, Clean install and No Extra Module,

morthylla’s picture

Hi

I've been trying to find the other issue related to Drupal 7, custom logos and private upload (as this issue was closed as duplicated). Seph, could you tell me where is it?

I have the same problem in a fresh install of Drupal 7, with only the MAYO theme installed.

Cheers

Seph’s picture

I reposted it here http://drupal.org/node/1088310 . I haven't gotten any comments there at all so I am considering reopening this one.

Seph’s picture

Status: Closed (duplicate) » Active
lathan’s picture

Tracking this have same issue with image attachments when using a private folder for images as field attachments.

webankit’s picture

FileSize
5.57 KB

problems while using pvt files: default logo & favicon doesn't work
Here i have attached a picture of what happens in place of logo

tough i uploaded them in public directory : sites/default/files/
sites/default/files/logo.jpg
sites/default/files/favicon.ico
it worked...

webankit’s picture

FileSize
29.74 KB

updated pic

l33tdawg’s picture

Sub

dpolant’s picture

FileSize
1.09 KB

I had this problem too. The issue was that the submit handler for the theme settings form was copying the file to the correct location out of the temp directory, but it was not updating the record in the db. I wrote a patch to fix this. I believe this was a core bug in the system module: it simply didn't manifest itself if you weren't using the private filesystem.

Obviously use this patch in a controlled environment. It hasn't been fully tested with non private filesystems.

webankit’s picture

#16: it worked when i uploaded custom shortcut icon but only if there is no custom logo...
Custom logo works fine...

dpolant’s picture

babbar, are you using private file system or public?

Uploading a shortcut icon with a logo image already present works fine on my private file system site.

dpolant’s picture

FileSize
1.22 KB

I fixed this patch so it correctly sets the status of the copied logo/shortcut file. When I tested it, it worked when both of these were being uploaded at the same time, or individually.

If we can determine that the patch works, I'll refactor it a bit (right now it's too repetitive).

Seph’s picture

I used the patch on my initial D7 install and it worked. I just upgraded my site to 7.2 and reapplied the patch and now it's not working again.

.tommie’s picture

Version: 7.0 » 7.2

Having this issue too with Drupal 7.2 (updated recently from 7.0, but still no luck).

aspilicious’s picture

Seph’s picture

I don't believe it is. The uploaded images when saved to private files are not disappearing. Drupal is not recognizing them and instead you get a broken image link on your page. When you check the files are in the correct location.

sun’s picture

Title: D7 not reading private file path for custom logo or icon. » Support private file path for custom logo or icon
Version: 7.2 » 8.x-dev
Component: file system » system.module
Category: bug » feature
Priority: Major » Normal

This patch conflicts with #901724: After uploading custom logo for theme the path points to root

And this is a feature request, which I'm actually tempted to mark as won't fix.

Seph’s picture

Category: feature » bug

I disagree. If people are having a problem when files are uploaded to the private file system, it is not a feature request!!!

I just started learning Drupal, coding, etc at the beginning of the year. Not everyone here is an accomplished developer/themer yet. There is no clear documentation on how the private vs public file system works. If Drupal uploads my logo to the private files..it should be able to read where it is and place it appropriately without a broken image link appearing. The same with any other file I upload. Correct me if I am wrong...but to me private files means, that no one can upload or download any site files without permission and there is no outside access, but Drupal itself still can access them and use them. Public files would be more for allowing users to upload and download images and files.

It seems to me that there are some issues with how the private file system actually works.

movinr8along’s picture

Version: 8.x-dev » 7.2

I have to agree with Seph. Did you even read post 16 and 19, Sun? It's a bug in core functionality that doesn't do what it's intended to. There is even a patch to work from already here in the thread. Hopefully it just needs to be tweaked to fit with 7.2.

Renzy’s picture

I have just installed D7.2 on MAMP local testing environment. The very first thing I did was go in and set a path for private files, then change the default method to be private files. Then I went into the default theme bartik and tried to upload a custom logo.

After browsing to my logo and uploading, this is the path set to my new custom logo:

private://mylogo.jpg

The system is not reading this file path - the logo does not display.

Just posting this in the hope this issue will remain open and move towards solution.

.tommie’s picture

Priority: Normal » Major

Can't believe this hasn't been fixed in 7.2 ...

Seph’s picture

Unfortunately, it seems to be an issue that is being ignored.

marcingy’s picture

Version: 7.2 » 8.x-dev
Category: bug » feature
Priority: Major » Normal

Bugs are fixed in head first and I agree with Sun this is a feature request

Seph’s picture

Version: 8.x-dev » 7.x-dev
Category: feature » bug
Priority: Normal » Major

This wasn't an issue in D6 when using the private file system. It shouldn't be an issue at all in D7!! It's pretty basic functionality....not a "feature request". When I upload my custom logo and icon (or upload any file) using the private file system as built into D7....Drupal SHOULD be able to find and access it without a problem or without having to set up anything special.

Is it a feature request because no one wants to deal with it and it's an easy way to pass it off?

marcingy’s picture

Version: 7.x-dev » 8.x-dev

This needs to be fix in d8 first if indeed it is a bug.

Seph’s picture

Try it yourself. It's very easy to duplicate. Do a clean install of D7, set the file system to private and upload a custom logo and icon.

Seph’s picture

Title: Support private file path for custom logo or icon » Not recognizing private file path for custom logo or icon
sun’s picture

Title: Not recognizing private file path for custom logo or icon » Custom logo and favicon stored in private filesystem if it is the default
Issue tags: +Needs tests, +Needs backport to D7

Thanks to #33 I finally understand the problem.

The previous issue title as well as earlier patches in the issue suggested a bogus problem and a bogus solution. Namely, allowing to deliver favicon, logo, etc from the private filesystem. Since files from the private filesystem are delivered via Drupal (and not the web server), that would imply a huge performance decrease. That's why I marked it as a feature request.

However, the actual problem is that System module does not enforce the public filesystem, so files are stored in the private filesystem if it is the default.

To move forward here, we need the simple steps to reproduce from #33 in a test.

Seph’s picture

@ sun...whew! Thanks for understanding the issue. When private filesystem is set as the default..all uploaded files are stored in the private filesystem. When Drupal goes to retrieve these files..whether it is a Custom logo or a pdf etc..the page shows as access not allowed or a broken image.

Renzy’s picture

To move forward here, we need the simple steps to reproduce from #33 in a test.

why do you need to reproduce this?

I would have thought that the example of a clean install of 7.2 that I provided (#27) would suffice? Who needs to reproduce it to move forward - is there anything else that can be done to help?

aspilicious’s picture

"To move forward here, we need the simple steps to reproduce from #33 in a test."
Read this again please....

We need the actual steps (the clicks on specific pages) to create this bug.

WHY?
Because we need to write a test for this.

WHY?
Because after implementing the test, the testbot should say that drupal core is broken.
When we have a failing test we can try to fix drupal core so that it won't fail anymore.
With the test we can verify it actually works.

sun’s picture

The actual steps to reproduce are clear and known already. See #33.

An automated test is required to confirm that the test is currently failing, to confirm that a proposed resolution fixes the bug, and lastly, to prevent us from re-introducing this bug in the future.

It's pointless to argue for or against this. Write the test and submit it as a patch instead, please. Don't have time to work on this myself currently, otherwise I would.

defconjuan’s picture

Yeah, this is still an issue in 7.x. Right after a fresh install, if you (a) go direct to the file system and enable the private file system and then (b) go to the theme or global theme settings and upload a custom logo and icon; then neither will work. Both upload fine as can be seen if you ssh (or ftp) into you private files directory. As a work-around, I just copied them (via ssh) from the private files directory to the public files directory and then updated the path in the theme to reflect the public path. It's a work-around but not everyone will have the access to do this.

dcotruta’s picture

My 2c worth is that this should not be regarded as a feature request, as the private file system is potentially very useful for me. I have not yet had a look to see how complex this is to fix, but I would be a very grateful puppy is this was fixed.

karschsp’s picture

Assigned: Unassigned » karschsp
karschsp’s picture

Status: Active » Needs review
FileSize
1.49 KB

Here's an updated patch from #19.

karschsp’s picture

Please ignore #43. Here's the actual patch. Sorry about that!

xjm’s picture

Tagging.

Looks straightforward enough. We still need a test that fails without the patch and passes with it.

dawehner’s picture

I wrote a patch which seemed to should fail, but it didn't.
Additional it adds tests for favicon.

sun’s picture

+++ b/modules/system/system.test
@@ -1603,28 +1603,58 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
-    // Upload a file to use for the logo.
...
+    // Upload a file to use for the logo

Please revert. ;)

+++ b/modules/system/system.test
@@ -1603,28 +1603,58 @@ class SystemThemeFunctionalTest extends DrupalWebTestCase {
+    // Setup a private file system, both the logo and the favicon should still be uploaded to public, so people can actually see it.
+    variable_set('file_default_scheme', 'private');
+    $logo_file = current($this->drupalGetTestFiles('image'));
+    $favicon_file = current($this->drupalGetTestFiles('image'));

I wonder whether we're not missing a next() here? Test might be passing because we're using the same files for the public vs. private test?

Minor: Comment should wrap at 80 chars.

6 days to next Drupal core point release.

dawehner’s picture

Thanks for the feedback!

I wonder whether we're not missing a next() here? Test might be passing because we're using the same files for the public vs. private test?

You are right about this, and this could be even a problem of the current way this test works.
If it's upload the same image twice it's just "random" that it's work.

Here is a new patch, but it still doesn't fail, sadly.

The comment part is corrected.

sun’s picture

Hm. Might be a testing framework issue? Or, can we actually reproduce this bug manually?

MarkRennes’s picture

Subscribing. No doubt making ALL file requests private is a performance hit. Is it possible to nominate some areas of the file space as private, leaving others public? E.g. by content type? Or by some user-authorisation-level / ACL field?

My use case is as follows. I am using Drupal to provide learning management system LMS capabilities. Here, two basic requirements are:

1. That students and teachers have access only to relevant materials
2. That work submitted by one student (or team of students - Organic Groups) be visible only to that team (where team includes also the teacher, so that she can assess the student work).

Since these requirements encompass a large majority of the site content, it is reasonable to make private files the system default and pay the performance price.

By contrast, I really don't care whether or not the logo is publicly visible!

And yes, I know that there are perfectly good LMS available elsewhere. I and others just want to do this using Drupal, where we can control what we get! See for example http://groups.drupal.org/lms-learning-management-system

I can and will live without a logo. But is there other similar functionality loss elsewhere in Drupal when private files are enabled?

Many thanks for your work to patch this issue.

xjm’s picture

Status: Needs review » Needs work

This is NW if the test doesn't fail, right?

sun’s picture

shrtfilm’s picture

I just experienced this same issue.

I installed the patch (thank you very much!) and it works great on the homepage.

However, I cannot upload logos onto my affiliate sites made through Domain Access. I get the same private filesystem error. So, the logo appears on the homepage, but I cannot upload custom logos for my affiliates.

Any guidance you can provide on a fix?

sun’s picture

Assigned: karschsp » Unassigned
Priority: Major » Normal

1) I don't think this is major. You need to have a private filesystem in the first place. And you can very easily work around the issue by uploading your logo/favicon to your host.

2) We should still start with tests. #1376166: Custom logo and favicon functionality inanely tries to support absolute local file paths landed for D8 in the meantime. Contrary to the patch in #48, I'd prefer to perform this test in a separate test method; i.e., not mixing the code into an existing test method. That is, because this test is very specific and different to the existing theme settings assertions.

webel’s picture

As far as I can tell this is/was still a problem with Drupal 7.23 (I know Drupal 7.24 is the latest). I appreciate that this is not a problem if you have access to the server, but I had delegated a site to a Drupal admin (only, no access to server) and it was a problem for him.

A simple workaround (tested) is to simply switch temporarily back to the public filesystem, browse under the theme settings for your logo and upload, then switch back to private filesystem.

ItalloSan’s picture

Cheers webel - very timely!

I had this problem today and your solution was just what I needed.

Shiraz Dindar’s picture

We're still using this patch (from #44). It stopped working as of Drupal 7.33 or 7.34. Here it is again for 7.34.

Sil68’s picture

I just encountered the very same issue with DP7.36. Daring as I am I tried the patch (#57) but it was to no avail.

izmeez’s picture

Sorry, I have no idea what the status of this is for D8.

However, thank you for D7 patch in #57. It applies without difficulty to drupal 7.38 and works as expected allowing custom logo and favicon (shortcut) image files to be uploaded as if public even when file system is set to private.

xaris.tsimpouris’s picture

Thank you for D7 patch in #57. It applies without difficulty also to Drupal 7.39

MikeFromPAintheUSA’s picture

Thanks, I just used patch #57 for openatrium 7.x-2.50. I have a fresh install with a private file system configured. I created a sub-theme from oaradix and made it the default. I disabled the OA branding module, which left me with the Radix logo. I attempted to upload my own logo. The logo was placed in the private directory - reloading the site displayed no logo (but no errors). I applied the patch directly from the file's directory: /var/www/html/modules/system$ patch < 1087250.logo-public-filesystem.057.patch

Re-uploaded the logo and problem solved. Thanks again.

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

SocialNicheGuru’s picture

patch in 57 introduces ';;' so it needs to be reworked

SocialNicheGuru’s picture

Status: Needs work » Needs review

i just updated the patch to remove the small error.

The last submitted patch, 57: 1087250.logo-public-filesystem.057.patch, failed testing. View results

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

donaldp’s picture

I've created a simple patch for the 8.3.x or 8.4.x branches which forces the uploaded logo or favicon file into public storage if by default Drupal is set to use the private storage. I can't believe that it's that simple though.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

borisson_’s picture

The solution in #70 is really, really simple and that's a good thing. I don't see why that wouldn't work. If we get more buy-in on that, we should add tests for this, to ensure that this behavior doesn't regress in the future.

dawehner’s picture

Even if it would be possible to find the favicon, it would be a major performance penalty to pay.

Potentially two extra bootstraps are not necessarily cheap.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

donaldp’s picture

The patch at #70 no longer works with Drupal 8.6.16 so here is an updated patch.

This won't work for 8.7.x as the processing of the uploaded logo and favicon has changed completely. I've not checked if the underlying issue is still there with 8.7. This issue is still present in 8.7. The logo is uploaded to the private file system and is then just returns a forbidden error. Hopefully I will get around to producing a new patch soon when I have to update this particular project to use 8.7.

donaldp’s picture

Updated patch for Drupal 8.7.1. This will change the file schema to 'public' if the default is 'private'.

Accidentally uploaded twice, the first time with a test against the wrong version.

donaldp’s picture

donaldp’s picture

I'll get this right at some point. This should be the patch tested against the correct version.

The last submitted patch, 76: 1087250-D8.7.1.logo-public.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Status: Needs review » Needs work

The last submitted patch, 78: 1087250-D8.7.1.logo-public.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

yogeshmpawar’s picture

Status: Needs work » Needs review

Setting back to Needs Review!
This is not happening anymore.

donaldp’s picture

An updated patch for 8.8.x as file_default_scheme() is deprecated.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

quietone credited kevib.

quietone’s picture

Issue summary: View changes
Issue tags: +Bug Smash Initiative

Closed #47709: private://logo.png gets a 403 for custom logos as a duplicate of this one. Although that was earlier than this issue, this issue has more discussion. Moving credit here.

quietone’s picture

Version: 8.9.x-dev » 9.1.x-dev
quietone’s picture

Adding a test. There is no interdiff with the previous test because the change is so small and the interdiff here between the fail patch and the success patch is sufficient.

Still to do:
This needs before and after screenshots added to the Issue summary.

The last submitted patch, 89: 1087250-89-fail.patch, failed testing. View results
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

raman.b’s picture

Removing a couple of unused use statements

quietone’s picture

Issue tags: +Needs screenshots
NitinLama’s picture

Assigned: Unassigned » NitinLama
NitinLama’s picture

Assigned: NitinLama » Unassigned
FileSize
317.76 KB
93.4 KB
420.06 KB
99.76 KB
287.73 KB

Applied patch #92 and it's working correctly as proposed resolution which is, always having public scheme for the logo.
@here adding the before and after ss of the patch.

quietone’s picture

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

@NitinLama, thanks for the screenshots! When completing screenshots for an issue, remove the 'needs screenshots tag' to keep the issue up to date. It will also prevent others who are looking to make screenshots spending time reading this issue when the work is already done.

I think the screeshots should be added to the Issue Summary and replace the 'TBA' for the before and after screenshots. Add any comments you think will help reviewers/committers. When that is done the tag for 'Needs issue summary update' can be removed.

Setting to NW for the Issue summary update.

NitinLama’s picture

Assigned: Unassigned » NitinLama
Issue summary: View changes
Issue tags: -Needs issue summary update

Here Updated the issue summary.

NitinLama’s picture

Assigned: NitinLama » Unassigned
quietone’s picture

Status: Needs work » Needs review

@NitinLama, thanks.

This now has an up to date Issue summary, screenshots, a fail patch #89, and a cleaned up patch #92.
This is ready for review.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

g-brodiei’s picture

Tested patch #92 on 9.5.x

The patch applies cleanly and allows uploaded files destination to be fixed to public scheme even when the default file scheme is set to private. Confirm it fixes the issue following the steps to reproduce.

Updated the test from #92 for deprecated functions and theme bartik to olivero on 10,
file_create_url()
file_url_transform_relative()

Deprecation notice for function: https://www.drupal.org/node/2940031
Deprecation notice for bartik: https://www.drupal.org/node/3223395#s-bartik

Staying put in NR for a review on new patch.

mstrelan’s picture

I'm not sure this is the right fix. If the default file system is private why is the logo and favicon any different? Is there a legitimate use case for the logo and favicon to be private? Perhaps to show a different image to different users, although in that case there would need to be other customisations as well.

Ignoring that, a couple minor points below.

  1. +++ b/core/modules/system/src/Form/ThemeSettingsForm.php
    @@ -460,6 +460,9 @@ public function submitForm(array &$form, FormStateInterface $form_state) {
    +    // Can't use private for these files as they will not be accessible.
    +    $default_scheme = ($default_scheme === 'private') ? 'public' : $default_scheme;
    

    This ternary is a bit awkward. How about this:

    if ($default_scheme === 'private') {
      $default_scheme = 'public';
    }
    

Do we need test coverage for the favicon too or just the logo?

g-brodiei’s picture

Providing new failtest for updated patch.

Forgot to mention the test on #92 fails for array structure assertion as well before any deprecation fix, this failure was fixed in #104.

_utsavsharma’s picture

Tried to fix the CCF in #106.
Please review.

Status: Needs review » Needs work

The last submitted patch, 107: 1087250-107.patch, failed testing. View results

g-brodiei’s picture

Hi @_utsavsharma,

#106 is a purposely test that fails to prove the test asserts the issue properly when the actual fix applies, so the patch content have its fix removed, the patch on #104 contains the actual fix.

It will be helpful if you're willing to adjust the patch on #104 too, thanks.

Hi @mstrelan,

In Drupal 8, private file permissions by default are given according to the entity to which they are attached. If the user has permission to view the entity, they will have permission to view the file.
- Jaypan on Drupal-stackexchange

Past discussion on #50 described their edge use case on why they needed restriction on private scheme (but not particularly for logo and favicon). But core doesn't provide a proper permission control for private files to be viewed without further alteration by contrib/custom module, which is rather confusing for theme uploading files through settings page. (as mentioned in this discussion Drupal Forum)

If what Jaypan stated on stackexchange is still true at D10, to fix it following the logic of Drupal, we need to allow both file field (logo and favicon) to respect theme's viewing permissions. Is this applicable?

Do we really need logo and favicon files to be set in private folder? Or choosable for users? I'd side with putting it under public scheme with the current approach.

mstrelan’s picture

Yes I agree using the private file system for this is setting you up for failure, just trying to see if there is a valid reason to do it.

g-brodiei’s picture

Status: Needs work » Needs review
FileSize
4.88 KB
4.26 KB

Update fix by #105, add test for favicons file field.
Fixed CCF error.

Cool, then we shall keep this approach for now till a second opinion gives otherwise.

Set to NR.

_utsavsharma’s picture

Fixed CCF error for #111.
Please review.

g-brodiei’s picture

Thanks for the help @_utsavsharma!

ameymudras’s picture

Status: Needs review » Needs work

I did review the patch in #111 and #112 and I have a question here

Why don't we specify the $scheme = 'public'; instead of all the checks below?

$default_scheme = $this->config('system.file')->get('default_scheme');
+    // Can't use private for these files as they will not be accessible.
+    if ($default_scheme === 'private') {
+      $default_scheme = 'public';
+    }
+

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.