Skip to content

Avatar filenames are not generated correctly for offline mode #3464

Closed
@sdwolfz

Description

@sdwolfz
  • Gitea version (or commit ref): 1.4.0-rc1
  • Git version: 2.11.0
  • Operating system: debian 9.0 docker container
  • 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:
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/assets/octicons/octicons.min.css for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/assets/octicons/octicons.min.css
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/assets/octicons/octicons.min.css 304 Not Modified in 488.958µs
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/semantic/semantic.min.css for 172.17.0.1
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /css/index.css?v=588d8efe1bec62df64b57058f0d7a1a6 for 172.17.0.1
web_1       | [Macaron] [Static] Serving /css/index.css
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /css/index.css?v=588d8efe1bec62df64b57058f0d7a1a6 304 Not Modified in 1.938641ms
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/cssrelpreload/cssrelpreload.min.js for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/plugins/cssrelpreload/cssrelpreload.min.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/cssrelpreload/cssrelpreload.min.js 304 Not Modified in 282.163µs
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/cssrelpreload/loadCSS.min.js for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/plugins/cssrelpreload/loadCSS.min.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/cssrelpreload/loadCSS.min.js 304 Not Modified in 202.592µs
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/jquery/jquery.min.js for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/plugins/jquery/jquery.min.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/jquery/jquery.min.js 304 Not Modified in 5.312349ms
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/jquery.areyousure/jquery.are-you-sure.js for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/plugins/jquery.areyousure/jquery.are-you-sure.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/jquery.areyousure/jquery.are-you-sure.js 304 Not Modified in 2.22141ms
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/autolink/autolink.js for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/plugins/autolink/autolink.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/autolink/autolink.js 304 Not Modified in 2.768939ms
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/clipboard/clipboard.min.js for 172.17.0.1
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/vue/vue.min.js for 172.17.0.1
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/emojify/emojify.min.js for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/plugins/clipboard/clipboard.min.js
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /vendor/plugins/semantic/semantic.min.js for 172.17.0.1
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /js/index.js?v=588d8efe1bec62df64b57058f0d7a1a6 for 172.17.0.1
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/clipboard/clipboard.min.js 304 Not Modified in 24.986321ms
web_1       | [Macaron] [Static] Serving /js/index.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /js/index.js?v=588d8efe1bec62df64b57058f0d7a1a6 304 Not Modified in 31.013033ms
web_1       | [Macaron] [Static] Serving /vendor/plugins/semantic/semantic.min.css
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/semantic/semantic.min.css 304 Not Modified in 67.389016ms
web_1       | [Macaron] [Static] Serving /vendor/plugins/emojify/emojify.min.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/emojify/emojify.min.js 304 Not Modified in 57.183724ms
web_1       | [Macaron] 2018-02-07 23:11:14: Started GET /avatars/4c5e13ee7ed915637efc079a7262df09 for 172.17.0.1
web_1       | [Macaron] [Static] Serving /vendor/plugins/vue/vue.min.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/vue/vue.min.js 304 Not Modified in 42.916652ms
web_1       | 2018/02/07 23:11:14 [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "id"=$1 LIMIT 1 []interface {}{1}
web_1       | 2018/02/07 23:11:14 [I] [SQL] SELECT count(*) FROM "notification" WHERE (user_id = $1) AND (status = $2) []interface {}{1, 0x1}
web_1       | 2018/02/07 23:11:14 [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "lower_name"=$1 LIMIT 1 []interface {}{"avatars"}
web_1       | [Macaron] [Static] Serving /vendor/plugins/semantic/semantic.min.js
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /vendor/plugins/semantic/semantic.min.js 304 Not Modified in 47.619902ms
web_1       | 2018/02/07 23:11:14 [I] [SQL] UPDATE "user" SET "avatar" = $1, "updated_unix" = $2 WHERE "id"=$3 []interface {}{"4c5e13ee7ed915637efc079a7262df09", 1518045074, 1}
web_1       | 2018/02/07 23:11:14 [I] New random avatar created: 1
web_1       | [Macaron] 2018-02-07 23:11:14: Completed GET /avatars/4c5e13ee7ed915637efc079a7262df09 404 Not Found in 27.111207ms
web_1       | [Macaron] 2018-02-07 23:11:15: Started GET /img/gitea-sm.png for 172.17.0.1
web_1       | [Macaron] 2018-02-07 23:11:15: Started GET /vendor/assets/font-awesome/css/font-awesome.min.css for 172.17.0.1
web_1       | [Macaron] [Static] Serving /img/gitea-sm.png
web_1       | [Macaron] 2018-02-07 23:11:15: Completed GET /img/gitea-sm.png 304 Not Modified in 655.935µs
web_1       | [Macaron] [Static] Serving /vendor/assets/font-awesome/css/font-awesome.min.css
web_1       | [Macaron] 2018-02-07 23:11:15: Completed GET /vendor/assets/font-awesome/css/font-awesome.min.css 304 Not Modified in 1.071448ms
web_1       | [Macaron] 2018-02-07 23:11:15: Started GET /api/v1/repos/search?uid=1&q=&limit=15&mode= for 172.17.0.1
web_1       | [Macaron] 2018-02-07 23:11:15: Completed GET /api/v1/repos/search?uid=1&q=&limit=15&mode= 200 OK in 5.866523ms
web_1       | 2018/02/07 23:11:15 [I] [SQL] SELECT "id", "lower_name", "name", "full_name", "email", "keep_email_private", "passwd", "login_type", "login_source", "login_name", "type", "location", "website", "rands", "salt", "created_unix", "updated_unix", "last_login_unix", "last_repo_visibility", "max_repo_creation", "is_active", "is_admin", "allow_git_hook", "allow_import_local", "allow_create_organization", "prohibit_login", "avatar", "avatar_email", "use_custom_avatar", "num_followers", "num_following", "num_stars", "num_repos", "description", "num_teams", "num_members", "diff_view_style" FROM "user" WHERE "id"=$1 LIMIT 1 []interface {}{1}
web_1       | 2018/02/07 23:11:15 [I] [SQL] SELECT count(*) FROM "repository" WHERE (owner_id=$1 OR ((id IN (SELECT repo_id FROM "access" WHERE access.user_id = $2)) AND owner_id<>$3)) []interface {}{1, 1, 1}
web_1       | 2018/02/07 23:11:15 [I] [SQL] SELECT "id", "owner_id", "lower_name", "name", "description", "website", "default_branch", "num_watches", "num_stars", "num_forks", "num_issues", "num_closed_issues", "num_pulls", "num_closed_pulls", "num_milestones", "num_closed_milestones", "is_private", "is_bare", "is_mirror", "is_fork", "fork_id", "size", "created_unix", "updated_unix" FROM "repository" WHERE (owner_id=$1 OR ((id IN (SELECT repo_id FROM "access" WHERE access.user_id = $2)) AND owner_id<>$3)) ORDER BY name ASC LIMIT 15 []interface {}{1, 1, 1}

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions