-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Correctly link URLs to users/repos with dashes, dots or underscores #18890
Correctly link URLs to users/repos with dashes, dots or underscores #18890
Conversation
This commit adds tests for full URLs referencing repos names and user names containing a dash.
729731f
to
7dcccb8
Compare
Sorry, mistake on my side. Inside |
Ah, no worries, my test case was wrong as well 😝 I'll revert it. |
7dcccb8
to
729731f
Compare
For the reference, here's my (now correct) simple test: https://go.dev/play/p/b4owdEOFUt3 |
🤖 |
Please send backport |
…o-gitea#18890) * Add tests for references with dashes This commit adds tests for full URLs referencing repos names and user names containing a dash. * Extend regex to match URLs to repos/users with dashes
Backport in #18908. |
Why is this marked to skip changelog? |
@Gusted The fix will be in v1.16.3's changelog, so it should not be in 1.17's changelog. |
…18890) (#18908) * Add tests for references with dashes This commit adds tests for full URLs referencing repos names and user names containing a dash. * Extend regex to match URLs to repos/users with dashes Co-authored-by: Alexander Neumann <[email protected]>
* giteaofficial/main: Fix page and missing return on unadopted repos API (go-gitea#18848) [skip ci] Updated licenses and gitignores Allow adminstrator teams members to see other teams (go-gitea#18918) Update nginx reverse proxy docs (go-gitea#18922) Don't treat BOM escape sequence as hidden character. (go-gitea#18909) Remove CodeMirror dependencies (go-gitea#18911) Uncapitalize errors (go-gitea#18915) Disable service worker by default (go-gitea#18914) Set is_empty in fixtures (go-gitea#18869) Don't update email for organisation (go-gitea#18905) Correctly link URLs to users/repos with dashes, dots or underscores (go-gitea#18890) Set is_private in fixtures. (go-gitea#18868) Fix team management UI (go-gitea#18886) Update JS dependencies (go-gitea#18898) Fix migration v210 (go-gitea#18892) migrations: add test for importing pull requests in gitea uploader (go-gitea#18752)
…o-gitea#18890) * Add tests for references with dashes This commit adds tests for full URLs referencing repos names and user names containing a dash. * Extend regex to match URLs to repos/users with dashes
This PR extends the regex which is used to match full URLs in all texts to issues/PRs in repos hosted on Gitea so that user/repo names with dashes, dots or underscores (e.g.
http://localhost:5000/some-user/reponame
) are matched correctly. The first commit introduces tests that fail, the second commit extends the regex from\w+
to[\w_.-]+
.I haven't found a central place where the user/repo name validation is performed. If there is a better way to do this please let me know. Thanks!
Closes #18888