Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
2 of 7 tasks
leafleia opened this issue Jan 16, 2020 · 4 comments
Closed
2 of 7 tasks
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail issue/stale type/bug

Comments

@leafleia
Copy link

  • 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
@techknowlogick
Copy link
Member

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 techknowlogick added the issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail label Jan 23, 2020
@leafleia
Copy link
Author

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

@stale
Copy link

stale bot commented 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 stale bot added the issue/stale label Mar 25, 2020
@stale
Copy link

stale bot commented Apr 8, 2020

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

@stale stale bot closed this as completed Apr 8, 2020
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/needs-feedback For bugs, we need more details. For features, the feature must be described in more detail issue/stale type/bug
Projects
None yet
Development

No branches or pull requests

3 participants