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

Closed
opened 2025-11-02 05:58:31 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @leafleia on GitHub (Jan 16, 2020).

  • 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
Originally created by @leafleia on GitHub (Jan 16, 2020). - Gitea version (or commit ref): 1.10.2 - Git version: 1.8.3.1 - Operating system: CentOS 7.7.1908 - Database: - [x] PostgreSQL - [ ] MySQL - [ ] MSSQL - [ ] SQLite - Can you reproduce the bug at https://try.gitea.io: - [ ] Yes (provide example URL) - [x] No - registration on https://try.gitea.io freezes - [ ] Not relevant - 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 ### :x: 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 ``` ### :white_check_mark: 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 ```
GiteaMirror added the issue/staletype/bugissue/needs-feedback labels 2025-11-02 05:58:31 -06:00
Author
Owner

@techknowlogick commented on GitHub (Jan 22, 2020):

Are you able to go to https://www.whatsmyip.org/more-info-about-you/ and report back with all the variables that start with HTTP_ under the Server & Network Information header in both safari and chrome?

@techknowlogick commented on GitHub (Jan 22, 2020): Are you able to go to https://www.whatsmyip.org/more-info-about-you/ and report back with all the variables that start with `HTTP_` under the `Server & Network Information` header in both safari and chrome?
Author
Owner

@leafleia commented on GitHub (Jan 25, 2020):

Safari

HTTP_HOST: www.whatsmyip.org
HTTP_ACCEPT: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8
HTTP_ACCEPT_LANGUAGE: en-gb
HTTP_CONNECTION: keep-alive
HTTP_ACCEPT_ENCODING: gzip, deflate, br
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15

Google Chrome

HTTP_HOST: www.whatsmyip.org
HTTP_CONNECTION: keep-alive
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36
HTTP_ACCEPT: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, image/apng, */*;q=0.8, application/signed-exchange;v=b3;q=0.9
HTTP_SEC_FETCH_SITE: none
HTTP_SEC_FETCH_MODE: navigate
HTTP_ACCEPT_ENCODING: gzip, deflate, br
HTTP_ACCEPT_LANGUAGE: en-GB, en-US;q=0.9, en;q=0.8
@leafleia commented on GitHub (Jan 25, 2020): ### Safari ``` HTTP_HOST: www.whatsmyip.org HTTP_ACCEPT: text/html, application/xhtml+xml, application/xml;q=0.9, */*;q=0.8 HTTP_ACCEPT_LANGUAGE: en-gb HTTP_CONNECTION: keep-alive HTTP_ACCEPT_ENCODING: gzip, deflate, br HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.4 Safari/605.1.15 ``` ### Google Chrome ``` HTTP_HOST: www.whatsmyip.org HTTP_CONNECTION: keep-alive HTTP_UPGRADE_INSECURE_REQUESTS: 1 HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36 HTTP_ACCEPT: text/html, application/xhtml+xml, application/xml;q=0.9, image/webp, image/apng, */*;q=0.8, application/signed-exchange;v=b3;q=0.9 HTTP_SEC_FETCH_SITE: none HTTP_SEC_FETCH_MODE: navigate HTTP_ACCEPT_ENCODING: gzip, deflate, br HTTP_ACCEPT_LANGUAGE: en-GB, en-US;q=0.9, en;q=0.8 ```
Author
Owner

@stale[bot] commented on GitHub (Mar 25, 2020):

This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.

@stale[bot] commented on GitHub (Mar 25, 2020): This issue has been automatically marked as stale because it has not had recent activity. I am here to help clear issues left open even if solved or waiting for more insight. This issue will be closed if no further activity occurs during the next 2 weeks. If the issue is still valid just add a comment to keep it alive. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (Apr 8, 2020):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (Apr 8, 2020): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#4661