go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
44.19k stars 5.42k forks source link

Umlauts not allowed in repo topic/misleading error message #7528

Open dadosch opened 5 years ago

dadosch commented 5 years ago

Description

When you try to add a topic to a repo with a Umlaut in it (äüö etc.) Gitea doesn't save it, but rather displays an error message that topics have to start with a letter or a number and must be no longer than 35 characters.

Screenshots

Screenshot_20190719_143752

mrsdizzie commented 5 years ago

This is bug of the original EN description since we only allow ASCII A-Za-z which is different than all "letters". I think we could do better for topics though and allow more characters like this example.

I think we could expand the check from ^[a-z0-9][a-z0-9-]*$ to ^[\p{L}0-9][\p{L}0-9-]*$ which is supported in Go.

See https://regex101.com/r/CoHxiW/2

mrsdizzie commented 5 years ago

We also check this in the front end in Javascript which unfortunately doesn't support unicode property escapes until ECMAScript 2018, turning this from a one line fix into something else :( I think we should get rid of that and validate in go and use ctx.Flash.Error like we do other places.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

OtherSystems commented 2 years ago

Hi, I run into something similar when trying to import non-english projects (in this care hawaiian). Some of the characters are not allowed.