Update failed if the website field is carried, when requesting /user/settings interface. #12857

Closed
opened 2025-11-02 10:23:08 -06:00 by GiteaMirror · 10 comments
Owner

Originally created by @Gitttttttt on GitHub (Apr 16, 2024).

Description

The request is:

curl -X 'PATCH' \ 'https://172.16.161.221:8080/api/v1/user/settings' \ -H 'accept: application/json' \ -H 'authorization: Basic cm9vdDp6ZHd3QDIwMjQ=' \ -H 'Content-Type: application/json' \ -d '{ "description": "", "location": "", "language": "zh-CN", "theme": "auto", "full_name": "root", "diff_view_style": "", "hide_email": true, "hide_activity": false, "website": "gitea.com" }'

The result is:

image

Is the parameter value wrong or Is it a bug?

Gitea Version

1.21.7

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

docker

Database

None

Originally created by @Gitttttttt on GitHub (Apr 16, 2024). ### Description The request is: `curl -X 'PATCH' \ 'https://172.16.161.221:8080/api/v1/user/settings' \ -H 'accept: application/json' \ -H 'authorization: Basic cm9vdDp6ZHd3QDIwMjQ=' \ -H 'Content-Type: application/json' \ -d '{ "description": "", "location": "", "language": "zh-CN", "theme": "auto", "full_name": "root", "diff_view_style": "", "hide_email": true, "hide_activity": false, "website": "gitea.com" }'` The result is: ![image](https://github.com/go-gitea/gitea/assets/38375081/699f1a26-3902-487c-a65e-fae25ac937ce) Is the parameter value wrong or Is it a bug? ### Gitea Version 1.21.7 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? docker ### Database None
GiteaMirror added the issue/confirmedtype/bugtype/upstream labels 2025-11-02 10:23:08 -06:00
Author
Owner

@lunny commented on GitHub (Apr 16, 2024):

Website should be https://gitea.com.

@lunny commented on GitHub (Apr 16, 2024): Website should be `https://gitea.com`.
Author
Owner

@Gitttttttt commented on GitHub (Apr 17, 2024):

@lunny I hava tryied, but got the same error, even with https://www.xxx.com:
image

@Gitttttttt commented on GitHub (Apr 17, 2024): @lunny I hava tryied, but got the same error, even with https://www.xxx.com: ![image](https://github.com/go-gitea/gitea/assets/38375081/3f60ee83-4d09-4149-8d4d-eb664f8c9c37)
Author
Owner

@lunny commented on GitHub (Apr 17, 2024):

I cannot reproduce this and I create a test PR in #30539. Maybe you can upgrade to 1.21.11 and try again?

@lunny commented on GitHub (Apr 17, 2024): I cannot reproduce this and I create a test PR in #30539. Maybe you can upgrade to 1.21.11 and try again?
Author
Owner

@Gitttttttt commented on GitHub (Apr 24, 2024):

@lunny I upgraded to 1.21.11 and tried again, but it's still the same error.
The version:
image

The request:
image

The response:
image

@Gitttttttt commented on GitHub (Apr 24, 2024): @lunny I upgraded to 1.21.11 and tried again, but it's still the same error. The version: ![image](https://github.com/go-gitea/gitea/assets/38375081/3a56951c-712c-4741-b957-8f515bd8fefc) The request: ![image](https://github.com/go-gitea/gitea/assets/38375081/28a2ca32-001b-43b7-9f02-bba3e17d9eb3) The response: ![image](https://github.com/go-gitea/gitea/assets/38375081/3e5cdda4-acd4-41da-9d42-d48efea68d85)
Author
Owner

@lunny commented on GitHub (Apr 24, 2024):

Please input token <your_token> in AuthorizationHeaderToken (apiKey) of the Authorized and try again.

@lunny commented on GitHub (Apr 24, 2024): Please input `token <your_token>` in `AuthorizationHeaderToken (apiKey)` of the `Authorized` and try again.
Author
Owner

@Gitttttttt commented on GitHub (Apr 24, 2024):

@lunny Like this? Seems to be the same result:

image

@Gitttttttt commented on GitHub (Apr 24, 2024): @lunny Like this? Seems to be the same result: ![image](https://github.com/go-gitea/gitea/assets/38375081/0ec7eb07-68fc-4795-b3dd-3f87ebb1d932)
Author
Owner

@lunny commented on GitHub (Apr 24, 2024):

Can you get the information about this request/response from Gitea's log?

@lunny commented on GitHub (Apr 24, 2024): Can you get the information about this request/response from Gitea's log?
Author
Owner

@Gitttttttt commented on GitHub (Apr 24, 2024):

@lunny The log only like this:
image

2024/04/24 11:01:08 ...eb/routing/logger.go:102:func1() [I] router: completed PATCH /api/v1/user/settings for 172.16.60.73:54290, 422 Unprocessable Entity in 32.4ms @ v1/api.go:689(v1.Routes.func1.7.1.bind[...])

@Gitttttttt commented on GitHub (Apr 24, 2024): @lunny The log only like this: ![image](https://github.com/go-gitea/gitea/assets/38375081/0ca22fc4-eb9d-4107-a2b5-6449ea2ad5a3) `2024/04/24 11:01:08 ...eb/routing/logger.go:102:func1() [I] router: completed PATCH /api/v1/user/settings for 172.16.60.73:54290, 422 Unprocessable Entity in 32.4ms @ v1/api.go:689(v1.Routes.func1.7.1.bind[...])`
Author
Owner

@wxiaoguang commented on GitHub (Apr 24, 2024):

It is a bug of go-chi/binding.

Main branch doesn't have such bug because its dependency has been upgraded.

On 1.21 branch, run go get gitea.com/go-chi/binding then build a new binary, then there won't be such bug.

@wxiaoguang commented on GitHub (Apr 24, 2024): It is a bug of `go-chi/binding`. Main branch doesn't have such bug because its dependency has been upgraded. On 1.21 branch, run `go get gitea.com/go-chi/binding` then build a new binary, then there won't be such bug.
Author
Owner

@lunny commented on GitHub (May 13, 2024):

Fixed by #30742

@lunny commented on GitHub (May 13, 2024): Fixed by #30742
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#12857