go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.6k stars 5.45k forks source link

Avatar filenames are not generated correctly for offline mode #3464

Closed sdwolfz closed 6 years ago

sdwolfz commented 6 years ago

When in offline mode, avatars for users are not generated correctly. The first user is a superadmin and is generated from the cli. The second user is created via the admin panel.

When looking in the avatars directory I can see 2 avatars being present but their filenames are consecutive integers (IDs I believe). There is no problem if I upload an image, It will show correctly and it is saved with the right name.

screenshot_2018-02-06_00-06-50 screenshot_2018-02-06_00-09-33 screenshot_2018-02-06_00-10-09

Here is the configuration for the server (this is a local setup, passwords and tokens are auto-generated and dispensable):

APP_NAME = Gitea: Git with a cup of tea
RUN_USER = git
RUN_MODE = prod

[security]
INTERNAL_TOKEN = <SECRET>
INSTALL_LOCK   = true
# Make sure to change this to a different value.
SECRET_KEY     = <SECRET>

[database]
DB_TYPE  = postgres
HOST     = postgres:5432
NAME     = gitea
USER     = postgres
# Make sure to change this to your postgres password. Also make sure to update
# the `postgres_secrets.env` file with the same password.
PASSWD   = <SECRET>
SSL_MODE = disable
PATH     = /work/data/gitea.db

[repository]
ROOT          = /work/repos
FORCE_PRIVATE = true

[server]
SSH_DOMAIN       = gitea.local
DOMAIN           = gitea.local
HTTP_PORT        = 3000
ROOT_URL         = http://gitea.local:10443/
DISABLE_SSH      = false
SSH_PORT         = 2222
START_SSH_SERVER = true
LFS_START_SERVER = true
LFS_CONTENT_PATH = /work/data/lfs
LFS_JWT_SECRET   = <SECRET>
OFFLINE_MODE     = true

[mailer]
ENABLED = false

[markdown]
# Enable hard line break extension
ENABLE_HARD_LINE_BREAK = true

[service]
REGISTER_EMAIL_CONFIRM            = false
ENABLE_NOTIFY_MAIL                = false
DISABLE_REGISTRATION              = true
ENABLE_CAPTCHA                    = false
REQUIRE_SIGNIN_VIEW               = true
DEFAULT_KEEP_EMAIL_PRIVATE        = true
DEFAULT_ALLOW_CREATE_ORGANIZATION = false
DEFAULT_ENABLE_TIMETRACKING       = false
NO_REPLY_ADDRESS                  = noreply.gitea.local

[picture]
DISABLE_GRAVATAR        = true
ENABLE_FEDERATED_AVATAR = false

[openid]
ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false

[session]
PROVIDER = file

[log]
MODE      = console,file
LEVEL     = Info
ROOT_PATH = /work/log
sdwolfz commented 6 years ago

I've edited the initial post to include a gist of the log. From what I understand, a new avatar is generated at every request, but it's saved to a file with the user's id instead of the md5 hash.