ui: 1.11.2 user avatar is missed in the header navbar #5021

Closed
opened 2025-11-02 06:11:10 -06:00 by GiteaMirror · 23 comments
Owner

Originally created by @RiverVanRain on GitHub (Mar 7, 2020).

  • Gitea version (or commit ref): 1.11.2
  • Git version: 2.11.0
  • Operating system: Debian
  • Database (use [x]):
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
    • No
    • Not relevant
  • Log gist:

Description

User avatar is not displayed after upgrading Gitea from 1.11.1 to 1.11.2.
All caches (system / browser) were cleared but this didn't help.
...

Screenshots

Originally created by @RiverVanRain on GitHub (Mar 7, 2020). - Gitea version (or commit ref): 1.11.2 - Git version: 2.11.0 - Operating system: Debian - Database (use `[x]`): - [ ] PostgreSQL - [x] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - [ ] Not relevant - Log gist: ## Description User avatar is not displayed after upgrading Gitea from 1.11.1 to 1.11.2. All caches (system / browser) were cleared but this didn't help. ... ## Screenshots
GiteaMirror added the issue/needs-feedback label 2025-11-02 06:11:10 -06:00
Author
Owner

@guillep2k commented on GitHub (Mar 7, 2020):

Hi, I can't reproduce. Would you please give us more information?:

  1. Is every user affected?
  2. Can you change your avatar? Does that have any effect?
  3. Check the generated HTML and see what URL is given for that avatar.
  4. Check the network log in the browser, check the server's response for the avatar picture (is it 404?).
  5. Check Gitea's logs and see if the avatar is actually served. Make sure ENABLE_ACCESS_LOG is set to true so all accesses are logged. You should see something like:
172.30.2.250 - - [07/Mar/2020:12:08:46 -0300] "GET /avatars/08a4754bc70fb29d15eb938b0dc5de18 HTTP/1.1" 200 3610 "\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0"

A final question: are you using a docker installation?

@guillep2k commented on GitHub (Mar 7, 2020): Hi, I can't reproduce. Would you please give us more information?: 1. Is every user affected? 2. Can you change your avatar? Does that have any effect? 3. Check the generated HTML and see what URL is given for that avatar. 4. Check the network log in the browser, check the server's response for the avatar picture (is it 404?). 5. Check Gitea's logs and see if the avatar is actually served. Make sure `ENABLE_ACCESS_LOG` is set to `true` so all accesses are logged. You should see something like: ``` 172.30.2.250 - - [07/Mar/2020:12:08:46 -0300] "GET /avatars/08a4754bc70fb29d15eb938b0dc5de18 HTTP/1.1" 200 3610 "\" \"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:73.0) Gecko/20100101 Firefox/73.0" ``` A final question: are you using a docker installation?
Author
Owner

@RiverVanRain commented on GitHub (Mar 7, 2020):

  1. Yes, it's.
  2. I did it. Nothing. I've removed the custom avatar even but the problem is still.
  3. In the browser's console is:
    <span class="text"></span>
    Instead of source.
  4. I've checked - all responses are OK with 200 status.
    Also, I haven't this problem in other places on the site (e.g. in the 'Switch Dashboard Context', on the User's profile, timeline) but on the header navbar only.
  5. Got it. All responses have 200 status.

No, i'm not using a docker installtion.

All browser's extensions and firewall are disabled.
Trying with the latest Chrome on the Windows 10.

Same issue on Firefox.

@RiverVanRain commented on GitHub (Mar 7, 2020): 1. Yes, it's. 2. I did it. Nothing. I've removed the custom avatar even but the problem is still. 3. In the browser's console is: `<span class="text"></span>` Instead of [source](https://github.com/go-gitea/gitea/blob/master/templates/base/head_navbar.tmpl#L80). 4. I've checked - all responses are OK with 200 status. Also, I haven't this problem in other places on the site (e.g. in the 'Switch Dashboard Context', on the User's profile, timeline) but on the header navbar only. 5. Got it. All responses have `200` status. No, i'm not using a docker installtion. All browser's extensions and firewall are disabled. Trying with the latest Chrome on the Windows 10. Same issue on Firefox.
Author
Owner

@zeripath commented on GitHub (Mar 7, 2020):

hmm... I wonder if it could be related to this: #10653
(Maybe we need this workaround in 1.11 #10655 too?)

--

I think I'm wrong here - I don't think that bug can be the cause.

@zeripath commented on GitHub (Mar 7, 2020): hmm... I wonder if it could be related to this: #10653 (Maybe we need this workaround in 1.11 #10655 too?) -- I think I'm wrong here - I don't think that bug can be the cause.
Author
Owner

@guillep2k commented on GitHub (Mar 7, 2020):

Only thing I can think of is that you're using a custom template that relies on something that has changed? A git blame doesn't show anything useful:

https://github.com/go-gitea/gitea/blame/v1.11.2/templates/base/head_navbar.tmpl

(lines 74-79)

Even when you've linked the template from master, the version from 1.11.2 linked above doesn't differ much in this aspect.

The template itself doesn't have any conditionals in that part, so if <span class="text"> appears, it must be followed by <img class="ui tiny avatar image" width="24" height="24" src="...">, even if the image had a bad link.

Just in case, we're talking about this, aren't we?

image

@guillep2k commented on GitHub (Mar 7, 2020): Only thing I can think of is that you're using a custom template that relies on something that has changed? A git blame doesn't show anything useful: https://github.com/go-gitea/gitea/blame/v1.11.2/templates/base/head_navbar.tmpl (lines 74-79) Even when you've linked the template from `master`, the version from `1.11.2` linked above doesn't differ much in this aspect. The template itself doesn't have any conditionals in that part, so if `<span class="text">` appears, it _must_ be followed by `<img class="ui tiny avatar image" width="24" height="24" src="...">`, even if the image had a bad link. Just in case, we're talking about this, aren't we? ![image](https://user-images.githubusercontent.com/18600385/76152879-87a69b00-60a3-11ea-8238-0a1e7eb7adef.png)
Author
Owner

@guillep2k commented on GitHub (Mar 7, 2020):

Did you build from sources? Because if you did, there's a 1 in 8 chance the build went wrong, as @zeripath pointed out. If you did, could you try building again (make clean-all ; make)? If you didn't, could you tell us the exact source of your binary? Maybe one of our generated binaries went wrong like that.

@guillep2k commented on GitHub (Mar 7, 2020): Did you build from sources? Because if you did, there's a 1 in 8 chance the build went wrong, as @zeripath pointed out. If you did, could you try building again (`make clean-all ; make`)? If you didn't, could you tell us the exact source of your binary? Maybe one of our generated binaries went wrong like that.
Author
Owner

@RiverVanRain commented on GitHub (Mar 8, 2020):

@guillep2k Yes, I've custom template but it doesn't change this piece of code:

<div class="ui dropdown jump item poping up" tabindex="-1" data-content="{{.i18n.Tr "user_profile_and_more"}}" data-variation="tiny inverted">
				<span class="text">
					<img class="ui tiny avatar image" src="{{.SignedUser.RelAvatarLink}}">
					<span class="sr-only">{{.i18n.Tr "user_profile_and_more"}}</span>
					<span class="mobile-only">{{.SignedUser.Name}}</span>
					<i class="fitted octicon octicon-triangle-down not-mobile" tabindex="-1"></i>
				</span>
				<div class="menu user-menu" tabindex="-1">
					<div class="ui header">
						{{.i18n.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong>
					</div>

This worked on version 1.11.1 before today's updating to 1.11.2:
screenshot-2020 03 08-01_14_26

I have been using Gitea since v1.8.6.
Gitea was installed from binary for Linux/Debian not from sources.
Subsequent updates were the same...

Another weird thing:
When I go to any page on the site the avatar appears for a short time and then disappears again.
As I wrote above, I turned off all browser extensions and cleared all caches.
Something (JS? CSS?) cuts out a piece of code between these tags: <span class="text"></span>
I tried in different layout modes using DevTools but that also doesn't help.
No errors in console.

I've created screencast in slow motion:
screen

Thanks for your great support!

@RiverVanRain commented on GitHub (Mar 8, 2020): @guillep2k Yes, I've custom template but it doesn't change this piece of code: ``` <div class="ui dropdown jump item poping up" tabindex="-1" data-content="{{.i18n.Tr "user_profile_and_more"}}" data-variation="tiny inverted"> <span class="text"> <img class="ui tiny avatar image" src="{{.SignedUser.RelAvatarLink}}"> <span class="sr-only">{{.i18n.Tr "user_profile_and_more"}}</span> <span class="mobile-only">{{.SignedUser.Name}}</span> <i class="fitted octicon octicon-triangle-down not-mobile" tabindex="-1"></i> </span> <div class="menu user-menu" tabindex="-1"> <div class="ui header"> {{.i18n.Tr "signed_in_as"}} <strong>{{.SignedUser.Name}}</strong> </div> ``` This worked on version 1.11.1 before today's updating to 1.11.2: ![screenshot-2020 03 08-01_14_26](https://user-images.githubusercontent.com/2176145/76153236-5e553180-60da-11ea-8ffa-c70d2709eeec.png) I have been using Gitea since v1.8.6. Gitea was installed [from binary](https://docs.gitea.io/en-us/install-from-binary/) for Linux/Debian not from sources. Subsequent updates were the same... **Another weird thing:** When I go to any page on the site the avatar appears for a short time and then disappears again. As I wrote above, I turned off all browser extensions and cleared all caches. Something (JS? CSS?) cuts out a piece of code between these tags: `<span class="text"></span>` I tried in different layout modes using DevTools but that also doesn't help. No errors in console. I've created screencast in slow motion: ![screen](https://user-images.githubusercontent.com/2176145/76154272-949aad00-60ea-11ea-8c87-eec51d680a1d.gif) Thanks for your great support!
Author
Owner

@silverwind commented on GitHub (Mar 8, 2020):

Maybe we need this workaround in 1.11 #10655 too

Not needed, 1.11 still has statically vendored fomantic-ui, the custom build is only in 1.12.

Regarding this issue: Maybe is is a bad JS cache? Try setting ui.USE_SERVICE_WORKER = false and then force-reload the page (CTRL-Shift-R in Firefox). Also I'd try removing any custom templates.

@silverwind commented on GitHub (Mar 8, 2020): > Maybe we need this workaround in 1.11 #10655 too Not needed, 1.11 still has statically vendored fomantic-ui, the custom build is only in 1.12. Regarding this issue: Maybe is is a bad JS cache? Try setting `ui.USE_SERVICE_WORKER = false` and then force-reload the page (CTRL-Shift-R in Firefox). Also I'd try removing any custom templates.
Author
Owner

@RiverVanRain commented on GitHub (Mar 8, 2020):

@silverwind Thanks for advice but I can't find this option via about:config in Firefox.
Also, I CTRL+Shift+R always.
Maybe need to say about my browsers' versions: Chrome 80.0.3987.116 \ Firefox 73.0.1

Also I'd try removing any custom templates.

I did it, clean the caches. Nothing.
Seems, it's the browser's issue.

@RiverVanRain commented on GitHub (Mar 8, 2020): @silverwind Thanks for advice but I can't find this option via `about:config` in Firefox. Also, I `CTRL+Shift+R` always. Maybe need to say about my browsers' versions: Chrome 80.0.3987.116 \ Firefox 73.0.1 > Also I'd try removing any custom templates. I did it, clean the caches. Nothing. Seems, it's the browser's issue.
Author
Owner

@zeripath commented on GitHub (Mar 8, 2020):

I wonder if it's something to do with the dropdown accessibility js?

@zeripath commented on GitHub (Mar 8, 2020): I wonder if it's something to do with the dropdown accessibility js?
Author
Owner

@silverwind commented on GitHub (Mar 8, 2020):

ui.USE_SERVICE_WORKER is in app.ini of Gitea. You can also temporarily disable dom.serviceWorkers.enabled in Firefox's about:config.

I wonder if it's something to do with the dropdown accessibility js?

Certainly seems possible. I suggest https://github.com/go-gitea/gitea/issues/10672 for its removal.

@silverwind commented on GitHub (Mar 8, 2020): `ui.USE_SERVICE_WORKER` is in `app.ini` of Gitea. You can also temporarily disable `dom.serviceWorkers.enabled` in Firefox's `about:config`. > I wonder if it's something to do with the dropdown accessibility js? Certainly seems possible. I suggest https://github.com/go-gitea/gitea/issues/10672 for its removal.
Author
Owner

@RiverVanRain commented on GitHub (Mar 8, 2020):

@zeripath Ah.. Understand now. I will do it.

@RiverVanRain commented on GitHub (Mar 8, 2020): @zeripath Ah.. Understand now. I will do it.
Author
Owner

@RiverVanRain commented on GitHub (Mar 8, 2020):

@silverwind Tricks with service worker didn't help.

@RiverVanRain commented on GitHub (Mar 8, 2020): @silverwind Tricks with service worker didn't help.
Author
Owner

@duchenpaul commented on GitHub (Mar 10, 2020):

@RiverVanRain Just try to click avatar button in the settings
image

@duchenpaul commented on GitHub (Mar 10, 2020): @RiverVanRain Just try to click avatar button in the settings ![image](https://user-images.githubusercontent.com/8120099/76305143-8e314e80-62ff-11ea-9b96-6c551ed12887.png)
Author
Owner

@RiverVanRain commented on GitHub (Mar 10, 2020):

@duchenpaul Just read this.

@RiverVanRain commented on GitHub (Mar 10, 2020): @duchenpaul Just [read this](https://github.com/go-gitea/gitea/issues/10659#issuecomment-596103318).
Author
Owner

@silverwind commented on GitHub (Mar 11, 2020):

Something (JS? CSS?) cuts out a piece of code between these tags:

Check in Browser devtools if the HTML response comes with the expected tags. At least then you'll know whether JS is interfering. CSS can not remove tags so should be of no concern.

@silverwind commented on GitHub (Mar 11, 2020): > Something (JS? CSS?) cuts out a piece of code between these tags: <span class="text"></span> Check in Browser devtools if the HTML response comes with the expected tags. At least then you'll know whether JS is interfering. CSS can not remove tags so should be of no concern.
Author
Owner

@lafriks commented on GitHub (Mar 11, 2020):

I can not seem to reproduce this on 1.11.3

@lafriks commented on GitHub (Mar 11, 2020): I can not seem to reproduce this on 1.11.3
Author
Owner

@RiverVanRain commented on GitHub (Mar 11, 2020):

@silverwind Checked already and can' t see any errors. All responses are OK (200 or 302 statuses).
Just the missed piece of code:
devtools

@lafriks Updating to 1.11.3 didn't solved this issue.

@RiverVanRain commented on GitHub (Mar 11, 2020): @silverwind Checked already and can' t see any errors. All responses are OK (200 or 302 statuses). Just the missed piece of code: ![devtools](https://user-images.githubusercontent.com/2176145/76465693-34ac4b00-63f7-11ea-82b4-20183f787d2c.png) @lafriks Updating to 1.11.3 didn't solved this issue.
Author
Owner

@RiverVanRain commented on GitHub (Mar 11, 2020):

Checked on the several OS and browsers (even Midori ;)) - same results.

@RiverVanRain commented on GitHub (Mar 11, 2020): Checked on the several OS and browsers (_even Midori ;)_) - same results.
Author
Owner

@silverwind commented on GitHub (Mar 11, 2020):

I meant yoou should go to the network tab, find the HTML request and check response payload and see if the missing HTML is there or not.

@silverwind commented on GitHub (Mar 11, 2020): I meant yoou should go to the network tab, find the HTML request and check response payload and see if the missing HTML is there or not.
Author
Owner

@RiverVanRain commented on GitHub (Mar 11, 2020):

I understood what you meant and as I've answered - all responses are ok; I can't find any missed HTML.

@RiverVanRain commented on GitHub (Mar 11, 2020): I understood what you meant and as I've answered - all responses are ok; I can't find any missed HTML.
Author
Owner

@RiverVanRain commented on GitHub (Mar 11, 2020):

Well.
Here's how I fixed it.

1 - In the head_navbar.tmpl changed this code:
<img class="ui tiny avatar image" src="{{.SignedUser.RelAvatarLink}}">
on
<img class="ui tiny avatar image" width="24" height="24" src="{{.SignedUser.RelAvatarLink}}">
2 - Stopped gitea.
3 - Cleared the caches.
4 - Started gitea again.

Now all works very well.

An error is missed width="24" height="24" in the head_navbar.tmpl of Gitea sources (I've used this file from there for my custom template).
But I found this here.

Thanks all for help. Issue is closed.

@RiverVanRain commented on GitHub (Mar 11, 2020): Well. Here's how I fixed it. 1 - In the `head_navbar.tmpl` changed this code: `<img class="ui tiny avatar image" src="{{.SignedUser.RelAvatarLink}}">` on `<img class="ui tiny avatar image" width="24" height="24" src="{{.SignedUser.RelAvatarLink}}">` 2 - Stopped gitea. 3 - Cleared the caches. 4 - Started gitea again. Now all works very well. An error is missed `width="24" height="24"` in the `head_navbar.tmpl` of [Gitea sources](https://github.com/go-gitea/gitea/archive/v1.11.2.zip) (I've used this file from there for my custom template). But I found this [here](https://github.com/go-gitea/gitea/blob/master/templates/base/head_navbar.tmpl#L80). Thanks all for help. Issue is closed.
Author
Owner

@guillep2k commented on GitHub (Mar 12, 2020):

Now I'm very intrigued. It's clear that some JS was removing the image, but why? Why adding a size would help? (maybe it depends on the image type e.g. SVG has no intrinsic size?).

@guillep2k commented on GitHub (Mar 12, 2020): Now I'm **very** intrigued. It's clear that some JS was removing the image, but why? Why adding a size would help? (maybe it depends on the image type e.g. SVG has no intrinsic size?).
Author
Owner

@RiverVanRain commented on GitHub (Mar 12, 2020):

I can’t say what’s going on.

First, I replaced my avatar with the site logo and it worked:
<img class="ui image" src="{{StaticUrlPrefix}}/img/logo.png">

Then I decided to remove one of the classes tiny and it worked again:
<img class="ui avatar image" src="{{.SignedUser.RelAvatarLink}}">

I began to understand what was happening and found a mismatching in the source code about which I wrote in my comment above.

My avatar is in PNG format.

@RiverVanRain commented on GitHub (Mar 12, 2020): I can’t say what’s going on. First, I replaced my avatar with the site logo and it worked: `<img class="ui image" src="{{StaticUrlPrefix}}/img/logo.png">` Then I decided to remove one of the classes `tiny` and it worked again: `<img class="ui avatar image" src="{{.SignedUser.RelAvatarLink}}">` I began to understand what was happening and found a mismatching in the source code about which I wrote in my comment above. My avatar is in PNG format.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#5021