[PR #3767] [MERGED] Fix some issues with special chars in branch names #17074

Closed
opened 2025-11-02 12:25:41 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-gitea/gitea/pull/3767
Author: @nubenum
Created: 4/7/2018
Status: Merged
Merged: 9/16/2018
Merged by: @lafriks

Base: masterHead: branch-special-chars


📝 Commits (10+)

  • beecaca Fix some issues with special chars in branch names
  • d9c1a01 switch to stdlib url escaping
  • f03bbf0 Merge branch 'master' into branch-special-chars
  • f11e90e Merge branch 'master' into branch-special-chars
  • 06991df Merge branch 'master' into branch-special-chars
  • 1237382 Fix legacy redirect for tree, fix code tab escape
  • e45e2e3 Merge branch 'master' into branch-special-chars
  • e4db446 move link parts to translations
  • c0ba41a Merge branch 'master' into branch-special-chars
  • 7e70b0e Merge branch 'master' into branch-special-chars

📊 Changes

12 files changed (+26 additions, -25 deletions)

View changed files

📝 templates/repo/activity.tmpl (+1 -1)
📝 templates/repo/branch/list.tmpl (+2 -2)
📝 templates/repo/commits_table.tmpl (+2 -2)
📝 templates/repo/editor/edit.tmpl (+2 -2)
📝 templates/repo/header.tmpl (+1 -1)
📝 templates/repo/home.tmpl (+1 -1)
📝 templates/repo/issue/view.tmpl (+1 -1)
📝 templates/repo/pulls/commits.tmpl (+1 -1)
📝 templates/repo/pulls/files.tmpl (+1 -1)
📝 templates/repo/release/list.tmpl (+8 -8)
📝 templates/repo/settings/branches.tmpl (+2 -2)
📝 templates/user/dashboard/feeds.tmpl (+4 -3)

📄 Description

Finally some fixes for the special char issues with branch and tag names (#3681):

  • Adding EscapePound where necessary for #?
  • Adding Escape where Str2Html is used to avoid " being stripped
  • Fix last references to legacy URL scheme where possible
  • Fix legacy redirect (ctx.Req.URL.String() is escaped, ctx.Params("*") is not, that is why TrimSuffix doesn't work)

Some i18n strings use the same argument for the branch name and the branch link. I've chosen to have the URL escapes displayed rather than getting a 404, but left them at the legacy URL scheme.

In some places, there are still issues, because JS or the server-side meddles with the escapes:

  • Create new pull request if default branch contains #?
  • Create commit on branch with #?
  • Define default branch with "
    ...and possibly others. For the time being, I deem them to be too irrelevant to be worth the effort.

I hope I haven't destroyed other things on my way.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-gitea/gitea/pull/3767 **Author:** [@nubenum](https://github.com/nubenum) **Created:** 4/7/2018 **Status:** ✅ Merged **Merged:** 9/16/2018 **Merged by:** [@lafriks](https://github.com/lafriks) **Base:** `master` ← **Head:** `branch-special-chars` --- ### 📝 Commits (10+) - [`beecaca`](https://github.com/go-gitea/gitea/commit/beecaca7db2c210d1dff98b573852541fd9485b7) Fix some issues with special chars in branch names - [`d9c1a01`](https://github.com/go-gitea/gitea/commit/d9c1a01c9ba30b16f0268abd11e463a707669340) switch to stdlib url escaping - [`f03bbf0`](https://github.com/go-gitea/gitea/commit/f03bbf0ce613830fd0bcd49010491597410d2452) Merge branch 'master' into branch-special-chars - [`f11e90e`](https://github.com/go-gitea/gitea/commit/f11e90e84a0b6bb11351089c580eca56e92530a1) Merge branch 'master' into branch-special-chars - [`06991df`](https://github.com/go-gitea/gitea/commit/06991dfb6911f530e1a5cbdc4711dabd712cda8d) Merge branch 'master' into branch-special-chars - [`1237382`](https://github.com/go-gitea/gitea/commit/1237382d65a4ab0d94c0a575d7317e734f47de59) Fix legacy redirect for tree, fix code tab escape - [`e45e2e3`](https://github.com/go-gitea/gitea/commit/e45e2e3b8fb2bdbec230a834f1cc3ad3a29b1b93) Merge branch 'master' into branch-special-chars - [`e4db446`](https://github.com/go-gitea/gitea/commit/e4db4469044d6d6200478a0f9f02b6f22d62f25a) move link parts to translations - [`c0ba41a`](https://github.com/go-gitea/gitea/commit/c0ba41a89b819bdfc639f28cc2c2d82c61b55360) Merge branch 'master' into branch-special-chars - [`7e70b0e`](https://github.com/go-gitea/gitea/commit/7e70b0e62de90221616e441655e87dfca4bed18d) Merge branch 'master' into branch-special-chars ### 📊 Changes **12 files changed** (+26 additions, -25 deletions) <details> <summary>View changed files</summary> 📝 `templates/repo/activity.tmpl` (+1 -1) 📝 `templates/repo/branch/list.tmpl` (+2 -2) 📝 `templates/repo/commits_table.tmpl` (+2 -2) 📝 `templates/repo/editor/edit.tmpl` (+2 -2) 📝 `templates/repo/header.tmpl` (+1 -1) 📝 `templates/repo/home.tmpl` (+1 -1) 📝 `templates/repo/issue/view.tmpl` (+1 -1) 📝 `templates/repo/pulls/commits.tmpl` (+1 -1) 📝 `templates/repo/pulls/files.tmpl` (+1 -1) 📝 `templates/repo/release/list.tmpl` (+8 -8) 📝 `templates/repo/settings/branches.tmpl` (+2 -2) 📝 `templates/user/dashboard/feeds.tmpl` (+4 -3) </details> ### 📄 Description Finally some fixes for the special char issues with branch and tag names (#3681): * Adding `EscapePound` where necessary for `#?` * Adding `Escape` where `Str2Html` is used to avoid `"` being stripped * Fix last references to legacy URL scheme where possible * Fix legacy redirect (`ctx.Req.URL.String()` is escaped, `ctx.Params("*")` is not, that is why TrimSuffix doesn't work) Some i18n strings use the same argument for the branch name and the branch link. I've chosen to have the URL escapes displayed rather than getting a 404, but left them at the legacy URL scheme. In some places, there are still issues, because JS or the server-side meddles with the escapes: * Create new pull request if default branch contains `#?` * Create commit on branch with `#?` * Define default branch with `"` ...and possibly others. For the time being, I deem them to be too irrelevant to be worth the effort. I hope I haven't destroyed other things on my way. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-02 12:25:41 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#17074