Skip to content

Conversation

juergenhoetzel
Copy link
Contributor

Prevents invalid UTF-8 encoding for Description and Website. Refs #7905

Prevents Internal Server errors when repo is created with description > 255 bytes, for example 160*ü (320 bytes):

üüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüüü

Copy link
Member

@lafriks lafriks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import is missing

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jul 5, 2020
Prevents invalid UTF-8 encoding for Description and Website. Refs go-gitea#7905
@juergenhoetzel juergenhoetzel force-pushed the fix-invalid-utf8-encoding branch from eab1d13 to 83550d1 Compare July 5, 2020 17:16
@juergenhoetzel
Copy link
Contributor Author

import is missing

Ups. Forgot to stage the import.

I just amended the commit

@lafriks lafriks added this to the 1.13.0 milestone Jul 5, 2020
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jul 5, 2020
@lunny
Copy link
Member

lunny commented Jul 6, 2020

So we also need to adjust the database column size.

@juergenhoetzel
Copy link
Contributor Author

So we also need to adjust the database column size.

255 is still below the current limits:

	Description         string             `xorm:"TEXT"`
	Website             string             `xorm:"VARCHAR(2048)"`

@lunny
Copy link
Member

lunny commented Jul 7, 2020

I don't know why we need to trim the content to 255 runes since it could hold 65535 bytes?

@juergenhoetzel
Copy link
Contributor Author

juergenhoetzel commented Jul 7, 2020

I don't know why we need to trim the content to 255 runes since it could hold 65535 bytes?

I also didn't knew. I just wanted to change as little as possible to avoid breaking other parts.

Actually according to the DB-schema it's 65536 Codepoints/Runes not bytes.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jul 7, 2020
@lafriks
Copy link
Member

lafriks commented Jul 7, 2020

🚀

@lafriks lafriks merged commit 30399cf into go-gitea:master Jul 7, 2020
@lafriks
Copy link
Member

lafriks commented Jul 7, 2020

Please send backport

techknowlogick added a commit that referenced this pull request Jul 7, 2020
* Trim to 255 runes instead of bytes

Prevents invalid UTF-8 encoding for Description and Website. Refs #7905

* Apply suggestions from code review

Co-authored-by: zeripath <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
@techknowlogick techknowlogick added the backport/done All backports for this PR have been created label Jul 8, 2020
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
* Trim to 255 runes instead of bytes

Prevents invalid UTF-8 encoding for Description and Website. Refs go-gitea#7905

* Apply suggestions from code review

Co-authored-by: zeripath <[email protected]>

Co-authored-by: techknowlogick <[email protected]>
Co-authored-by: zeripath <[email protected]>
Co-authored-by: Lauris BH <[email protected]>
@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
backport/done All backports for this PR have been created lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants