Avatars gone after upgrading to 1.20.3

It seems like the avatars from all users of my gitea instance are gone after updating from 1.20.3. I don’t remember what version I used before, it was either 1.19.x or 1.20.2.

The issue looks like this:

The files are still present on the server and have the correct permissions:

gitea@machine:~/data/avatars$ ls -l
insgesamt 272
-rw-r--r-- 1 gitea gitea 42119 Mär 13  2020 2dccbab95b05b0c2129cd89f3cb44e93
-rw-r--r-- 1 gitea gitea 88730 Mär 13  2020 37f7a7cfa63c0d8bdb48fd53b8ed15fe
-rw-r--r-- 1 gitea gitea 88662 Feb 12  2018 5068956a6e42c34fe50ea33217f65b57
-rw-r--r-- 1 gitea gitea  1260 Mär 13  2020 6ecb852e8ce1b3cd5b0dfb3e2329fbf8
-rw-r--r-- 1 gitea gitea  1595 Mai 26  2020 7
-rw-r--r-- 1 gitea gitea 42215 Feb 12  2018 9896d479bd67a9a335d318b5ab97ef2d

What could be causing this?

1 Like

This maybe caused by the storage path parse method changed. Could you paste your avatar storage configurations in your app.ini?

1 Like

That section looks like this:

[picture]
AVATAR_UPLOAD_PATH = data/avatars

If it’s meant to be a relative path to the binary, then it seems to be a valid path (compare with the output of ls from the initial post).

Do you need more info than that?

Could you paste your other configurations? Especially [storage]. And you can also try change [picture] AVATAR_UPLOAD_PATH = data/avatars to an absolute path or change it to [picture] AVATAR_UPLOAD_PATH = avatars and take a look whether it fix your problem.

1 Like

That fixed it, thanks a lot!

I have some other relative path variables with prefixed data/ in my conf file. For instance:

[lfs]
; Where your lfs files put on, default is data/lfs.
PATH = data/lfs

[attachment]
; Whether attachments are enabled. Defaults to `true`
ENABLE = true
; Path for attachments. Defaults to `data/attachments`
PATH = data/attachments

Are all of these wrong now and also need to be corrected? This used to be a default setting some time ago, so a breaking change like this wouldn’t be great to happen so silently.

Maybe you can try to change PATH=data/attachments to PATH=attachments.

I still don’t understand why I’d change PATH = data/attachments and AVATAR_UPLOAD_PATH = data/avatars to PATH = attachments and AVATAR_UPLOAD_PATH = avatars but leave PATH = data/lfs the way it is?

Just to be clear, only some path settings (like avatars and attachments) need to have the data directory removed and some still need to have it present (like LFS data)?

That’s because the relative path’s base path changed. Before it will be app path, now it becomes data path. Sorry for the break, I think we have notices on release notes.

My question was why to change only the path of attachments and leave other path variables like lfs the way they are. Turns out, you have to change all path variables, so also the LFS path variable needs to be changed from PATH = data/lfs to PATH = lfs. Otherwise there’ll be issues when cloning a repo with LFS data.

1 Like

If the app.ini is read only (e.g. because it is mapped into a docker container as read only file) gitea can’t write the work path as WORK_PATH to the app.ini file on startup. Instead of changing all the default relative paths you could try to just set WORK_PATH to the correct location.

See Refactor path & config system (#25330) by wxiaoguang · Pull Request #25416 · go-gitea/gitea · GitHub for some additional options to set the work path.

The PR is mentioned in the release notes but sadly there is no hint about this issue yet.