Profile images do not work with nested subfolder install

(Vikas Kedia) #1

I am using the latest docker version of Discourse.

I have tried uploading the profile image multiple times and it still does not show up.

Please see this video demo:

(Joshua Rosenfeld) #2

Are you fully up to date? I feel like there was a bug about this a little while ago…

Nevermind…was thinking of something unrelated.

(Jeff Atwood) #3

Can you upload the image here in a reply please.

(Vikas Kedia) #4

Here is the image that I am uploading as a profile image:

(Jeff Atwood) #5

I just changed your profile image here to that picture and had no issues. There is likely some problem with your Discourse install?

(Vikas Kedia) #6

I am using the latest version of discourse using discourse_docker and I installed it 2 days ago.

There are 2 things specific to my install:

  1. I am running it from a subfolder.

  2. I am a oauth user.

Any idea how I would go about debugging this ?

(Rafael dos Santos Silva) #7

I never saw a multi level nested subfolder install of Discourse (one level is rare enough) so maybe it’s related. Do you get any info on /logs page?

(Vikas Kedia) #8

There is nothing interesting in nginx/error.log

Where are the profile images stored ?

I want to make sure that the profile image got uploaded properly. And the problem is in retrieving it.

(Vikas Kedia) #9

@codinghorror I think I got the bug:

In the table users the uploaded_avatar_id is 84

In the table uploads I see this entry:

And I am able to load the url given in the url field of uploads table.

But in the profile image html the URL embedded is: .xyz Domain Names | Join Generation XYZ

Obviously the system is not able to translate the image id to image name on the file system.

Obviously 84_1.png needs to be sent to rails to convert it to the file name on the file system 7ea0bd1720642b6f2349b5e82e42e45813893028.png

In the video you will see that:

Right after uploading the image the profile image shows properly on the 1st refresh. Since at that point the html is pointing to /v3/app/discourse/uploads/default/original/1X/7ea0bd1720642b6f2349b5e82e42e45813893028.png

But from 2nd refresh the html points to 84_1.png and from then on the profile image does not render since 84_1.png translation to 7ea0bd1720642b6f2349b5e82e42e45813893028.png is failing.

I think this whole class of edge cases can be avoided by just giving the path to actual file on the file system and not the id as the src of the profile image.