Avatars broken (404) after turning on offline mode #14598

Open
opened 2025-11-02 11:17:11 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @jjakob on GitHub (Jun 13, 2025).

Description

Hi, I recently upgraded from 1.18-rootless to 1.23.8-rootless (Docker image) and turned on OFFLINE_MODE. Now the majority of avatars return a 404 Not Found. All except one or two users that already have a generated identicon avatar in AVATAR_UPLOAD_PATH (which I have not changed, so it's the default data/avatars).

2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-9: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48
(request)
2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started   GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48
for 192.0.2.123:0
2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48 for 192.0.2.123:0, 304 Not Modified in 0.2ms @ web/base.go:22(avatars)
2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-9: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48
2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-10: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56 (request)
2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started   GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56
for 192.0.2.123:0
2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56 for 192.0.2.123:0, 304 Not Modified in 0.2ms @ web/base.go:22(avatars)
2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-10: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56
2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-11: GET: /assets/img/avatar_default.png (request)
2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started   GET /assets/img/avatar_default.png for 192.0.2.123:0
2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [T] router: completed GET /assets/img/avatar_default.png for 192.0.2.123:0, 304 Not Modified in 0.3ms @ public/public.go:34(web.Routes.FileHandlerFunc)
2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-11: GET: /assets/img/avatar_default.png
2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-12: GET: /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56 (request)
2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started   GET /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56
for 192.0.2.123:0
2025/06/13 11:46:26 routers/web/base.go:80:func2() [W] Unable to find avatars e54a67e2d5217fc0e9d862d7f8fb9e52
2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56 for 192.0.2.123:0, 404 Not Found in 0.2ms @ web/base.go:22(avatars)
2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-12: GET: /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56
2025/06/13 11:46:27 ...s/process/manager.go:188:Add() [T] Start 684bf373: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56 (request)
2025/06/13 11:46:27 ...eb/routing/logger.go:47:func1() [T] router: started   GET /avatars/f62947b0c532f786c9131d480839fa80?size=56
for 192.0.2.123:0
2025/06/13 11:46:27 routers/web/base.go:80:func2() [W] Unable to find avatars f62947b0c532f786c9131d480839fa80
2025/06/13 11:46:27 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/f62947b0c532f786c9131d480839fa80?size=56 for 192.0.2.123:0, 404 Not Found in 0.2ms @ web/base.go:22(avatars)
2025/06/13 11:46:27 ...s/process/manager.go:231:remove() [T] Done 684bf373: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56
2025/06/13 11:46:27 ...s/process/manager.go:188:Add() [T] Start 684bf373-2: GET: /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode= (request)
2025/06/13 11:46:27 ...eb/routing/logger.go:47:func1() [T] router: started   GET /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode= for 192.0.2.123:0
2025/06/13 11:46:27 ...ices/auth/session.go:40:Verify() [T] Session Authorization: Found user[4]
2025/06/13 11:46:27 ...ices/auth/session.go:58:Verify() [T] Session Authorization: Logged in user <User 4:jjakob>
2025/06/13 11:46:27 ...eb/routing/logger.go:102:func1() [I] router: completed GET /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode= for 192.0.2.123:0, 200 OK in 11.8ms @ repo/repo.go:573(repo.SearchRepo)
2025/06/13 11:46:27 ...s/process/manager.go:231:remove() [T] Done 684bf373-2: GET: /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode=
2025/06/13 11:46:28 ...s/process/manager.go:188:Add() [T] Start 684bf374: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56 (request)
2025/06/13 11:46:28 ...eb/routing/logger.go:47:func1() [T] router: started   GET /avatars/f62947b0c532f786c9131d480839fa80?size=56
for 192.0.2.123:0
2025/06/13 11:46:28 routers/web/base.go:80:func2() [W] Unable to find avatars f62947b0c532f786c9131d480839fa80
2025/06/13 11:46:28 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/f62947b0c532f786c9131d480839fa80?size=56 for 192.0.2.123:0, 404 Not Found in 0.2ms @ web/base.go:22(avatars)
2025/06/13 11:46:28 ...s/process/manager.go:231:remove() [T] Done 684bf374: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56

# ls -la /var/lib/docker/volumes/gitea_gitea_data/_data/data/avatars/
total 43
drwxr-xr-x  3 user user    6 Jun 12 14:22 .
drwxr-xr-x 17 user user   17 Jun  8 23:32 ..
-rw-r--r--  1 user user 6963 Jul 11  2016 5
-rw-r--r--  1 user user 2910 Jun 12 14:22 bad9514210ef09d73b6d247917098255
-rw-r--r--  1 user user 1659 Jul 17  2023 d1a1fdf98d5a545a173aee017c9a1ee1
drwxr-xr-x  2 user user    2 Jun 12 14:22 tmp

Gitea Version

1.23.8-rootless

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Run in Docker

Database

PostgreSQL

Originally created by @jjakob on GitHub (Jun 13, 2025). ### Description Hi, I recently upgraded from 1.18-rootless to 1.23.8-rootless (Docker image) and turned on `OFFLINE_MODE`. Now the majority of avatars return a 404 Not Found. All except one or two users that already have a generated identicon avatar in `AVATAR_UPLOAD_PATH` (which I have not changed, so it's the default `data/avatars`). ``` 2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-9: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48 (request) 2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48 for 192.0.2.123:0 2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48 for 192.0.2.123:0, 304 Not Modified in 0.2ms @ web/base.go:22(avatars) 2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-9: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=48 2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-10: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56 (request) 2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56 for 192.0.2.123:0 2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56 for 192.0.2.123:0, 304 Not Modified in 0.2ms @ web/base.go:22(avatars) 2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-10: GET: /avatars/d1a1fdf98d5a545a173aee017c9a1ee1?size=56 2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-11: GET: /assets/img/avatar_default.png (request) 2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started GET /assets/img/avatar_default.png for 192.0.2.123:0 2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [T] router: completed GET /assets/img/avatar_default.png for 192.0.2.123:0, 304 Not Modified in 0.3ms @ public/public.go:34(web.Routes.FileHandlerFunc) 2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-11: GET: /assets/img/avatar_default.png 2025/06/13 11:46:26 ...s/process/manager.go:188:Add() [T] Start 684bf372-12: GET: /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56 (request) 2025/06/13 11:46:26 ...eb/routing/logger.go:47:func1() [T] router: started GET /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56 for 192.0.2.123:0 2025/06/13 11:46:26 routers/web/base.go:80:func2() [W] Unable to find avatars e54a67e2d5217fc0e9d862d7f8fb9e52 2025/06/13 11:46:26 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56 for 192.0.2.123:0, 404 Not Found in 0.2ms @ web/base.go:22(avatars) 2025/06/13 11:46:26 ...s/process/manager.go:231:remove() [T] Done 684bf372-12: GET: /avatars/e54a67e2d5217fc0e9d862d7f8fb9e52?size=56 2025/06/13 11:46:27 ...s/process/manager.go:188:Add() [T] Start 684bf373: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56 (request) 2025/06/13 11:46:27 ...eb/routing/logger.go:47:func1() [T] router: started GET /avatars/f62947b0c532f786c9131d480839fa80?size=56 for 192.0.2.123:0 2025/06/13 11:46:27 routers/web/base.go:80:func2() [W] Unable to find avatars f62947b0c532f786c9131d480839fa80 2025/06/13 11:46:27 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/f62947b0c532f786c9131d480839fa80?size=56 for 192.0.2.123:0, 404 Not Found in 0.2ms @ web/base.go:22(avatars) 2025/06/13 11:46:27 ...s/process/manager.go:231:remove() [T] Done 684bf373: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56 2025/06/13 11:46:27 ...s/process/manager.go:188:Add() [T] Start 684bf373-2: GET: /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode= (request) 2025/06/13 11:46:27 ...eb/routing/logger.go:47:func1() [T] router: started GET /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode= for 192.0.2.123:0 2025/06/13 11:46:27 ...ices/auth/session.go:40:Verify() [T] Session Authorization: Found user[4] 2025/06/13 11:46:27 ...ices/auth/session.go:58:Verify() [T] Session Authorization: Logged in user <User 4:jjakob> 2025/06/13 11:46:27 ...eb/routing/logger.go:102:func1() [I] router: completed GET /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode= for 192.0.2.123:0, 200 OK in 11.8ms @ repo/repo.go:573(repo.SearchRepo) 2025/06/13 11:46:27 ...s/process/manager.go:231:remove() [T] Done 684bf373-2: GET: /repo/search?count_only=1&uid=4&team_id=undefined&q=&page=1&mode= 2025/06/13 11:46:28 ...s/process/manager.go:188:Add() [T] Start 684bf374: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56 (request) 2025/06/13 11:46:28 ...eb/routing/logger.go:47:func1() [T] router: started GET /avatars/f62947b0c532f786c9131d480839fa80?size=56 for 192.0.2.123:0 2025/06/13 11:46:28 routers/web/base.go:80:func2() [W] Unable to find avatars f62947b0c532f786c9131d480839fa80 2025/06/13 11:46:28 ...eb/routing/logger.go:102:func1() [I] router: completed GET /avatars/f62947b0c532f786c9131d480839fa80?size=56 for 192.0.2.123:0, 404 Not Found in 0.2ms @ web/base.go:22(avatars) 2025/06/13 11:46:28 ...s/process/manager.go:231:remove() [T] Done 684bf374: GET: /avatars/f62947b0c532f786c9131d480839fa80?size=56 ``` ``` # ls -la /var/lib/docker/volumes/gitea_gitea_data/_data/data/avatars/ total 43 drwxr-xr-x 3 user user 6 Jun 12 14:22 . drwxr-xr-x 17 user user 17 Jun 8 23:32 .. -rw-r--r-- 1 user user 6963 Jul 11 2016 5 -rw-r--r-- 1 user user 2910 Jun 12 14:22 bad9514210ef09d73b6d247917098255 -rw-r--r-- 1 user user 1659 Jul 17 2023 d1a1fdf98d5a545a173aee017c9a1ee1 drwxr-xr-x 2 user user 2 Jun 12 14:22 tmp ``` ### Gitea Version 1.23.8-rootless ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Run in Docker ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 11:17:11 -06:00
Author
Owner

@wxiaoguang commented on GitHub (Jun 20, 2025):

Could you try to set user.use_custom_avatar=false(0) in database and set user.avatar field to empty string? Then the avatars will be re-generated IIRC

@wxiaoguang commented on GitHub (Jun 20, 2025): Could you try to set `user.use_custom_avatar=false(0)` in database and set `user.avatar` field to empty string? Then the avatars will be re-generated IIRC
Author
Owner

@jjakob commented on GitHub (Jun 26, 2025):

I did as you suggested (for just one user, to test) and it worked, the avatar was generated and is now shown. All the users that had broken avatars already had use_custom_avatar=f, had avatar hashes, but no directories or images in the avatars directory with those hashes.
The (only) user that previously displayed an avatar had use_custom_avatar=t, an avatar hash and existing directory and images with that hash.
So I could possibly fix it by clearing the avatar hash in the database for all users, but isn't this an issue that others will hit too when switching on offline mode? How were avatars working previously with offline mode turned off but no images in the avatars directory? Was the avatar image always generated when rendering the page and never saved?

@jjakob commented on GitHub (Jun 26, 2025): I did as you suggested (for just one user, to test) and it worked, the avatar was generated and is now shown. All the users that had broken avatars already had `use_custom_avatar=f`, had avatar hashes, but no directories or images in the avatars directory with those hashes. The (only) user that previously displayed an avatar had `use_custom_avatar=t`, an avatar hash and existing directory and images with that hash. So I could possibly fix it by clearing the avatar hash in the database for all users, but isn't this an issue that others will hit too when switching on offline mode? How were avatars working previously with offline mode turned off but no images in the avatars directory? Was the avatar image always generated when rendering the page and never saved?
Author
Owner

@wxiaoguang commented on GitHub (Jun 26, 2025):

Thank you for the feedback. Maybe there are some bugs, but I can't tell at the moment .... I am not quite familiar with these details.

@wxiaoguang commented on GitHub (Jun 26, 2025): Thank you for the feedback. Maybe there are some bugs, but I can't tell at the moment .... I am not quite familiar with these details.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14598