Skip to content

Error updating user language in DB on first time user login with Safari #9806

Closed
@leafleia

Description

@leafleia
  • Gitea version (or commit ref): 1.10.2
  • Git version: 1.8.3.1
  • Operating system: CentOS 7.7.1908
  • Database:
    • PostgreSQL
    • MySQL
    • MSSQL
    • SQLite
  • Can you reproduce the bug at https://try.gitea.io:
  • Log gist:

Description

Can be reproduced only on Safari.

On first time user login Gitea doesn't redirect to user page and shows empty page (http://gitea-host:3000/user/login). It seems Gitea incorrectly defines user locale in Safari - "en-US-u-rg-gbzzzz" instead of "en-US".

Workaround

First time (after creating user) login with Google Chrome. On next logins with Safari Gitea will redirect to user page correctly.

Logs

❌ First time login with Safari 13.0.4 (15608.4.9.1.3):

journalctl -f -u gitea:

Jan 16 09:58:32 centos-gitea gitea[2561]: [Macaron] 2020-01-16 09:58:32: Started POST /user/login for x.x.x.x
Jan 16 09:58:32 centos-gitea gitea[2561]: [Macaron] 2020-01-16 09:58:32: Completed POST /user/login 0  in 28.931661ms

/var/lib/gitea/log/gitea.log:

2020/01/16 09:58:32 .../xorm/session_raw.go:194:exec() [I] [SQL] UPDATE "user" SET "language" = $1, "updated_unix" = $2 WHERE "id"=$3 []interface {}{"en-US-u-rg-gbzzzz", 1579168712, 1} - took: 552.034µs
2020/01/16 09:58:32 routers/user/auth.go:509:handleSignInFull() [E] Error updating user language [user: 1, locale: en-US-u-rg-gbzzzz]

/var/lib/pgsql/data/pg_log/postgresql-Thu.log:

ERROR:  value too long for type character varying(5)
STATEMENT:  UPDATE "user" SET "language" = $1, "updated_unix" = $2 WHERE "id"=$3

✅ First time login with Google Chrome 79.0.3945.117:

journalctl -f -u gitea:

Jan 16 10:04:14 centos-gitea gitea[2561]: [Macaron] 2020-01-16 10:04:14: Started POST /user/login for x.x.x.x
Jan 16 10:04:14 centos-gitea gitea[2561]: [Macaron] 2020-01-16 10:04:14: Completed POST /user/login 302 Found in 31.779065ms
Jan 16 10:04:14 centos-gitea gitea[2561]: [Macaron] 2020-01-16 10:04:14: Started GET / for x.x.x.x
Jan 16 10:04:14 centos-gitea gitea[2561]: [Macaron] 2020-01-16 10:04:14: Completed GET / 200 OK in 6.979358ms
...

/var/lib/gitea/log/gitea.log:

2020/01/16 10:04:14 .../xorm/session_raw.go:194:exec() [I] [SQL] UPDATE "user" SET "language" = $1, "updated_unix" = $2 WHERE "id"=$3 []interface {}{"en-US", 1579169054, 1} - took: 2.036066ms

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detailissue/staletype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions