mirror of
1
Fork 0
forgejo/routers/repo
mrsdizzie ca46385637 Clean up various use of escape/unescape functions for URL generation (#6334)
* Use PathUnescape instead of QueryUnescape when working with branch names

Currently branch names with a '+' fail in certain situations because
QueryUnescape replaces the + character with a blank space.

Using PathUnescape should be better since it is defined as:

// PathUnescape is identical to QueryUnescape except that it does not
// unescape '+' to ' ' (space).

Fixes #6333

* Change error to match new function name

* Add new util function PathEscapeSegments

This function simply runs PathEscape on each segment of a path without
touching the forward slash itself. We want to use this instead of
PathEscape/QueryEscape in most cases because a forward slash is a valid name for a
branch etc... and we don't want that escaped in a URL.

Putting this in new file url.go and also moving a couple similar
functions into that file as well.

* Use EscapePathSegments where appropriate

Replace various uses of EscapePath/EscapeQuery with new
EscapePathSegments. Also remove uncessary uses of various
escape/unescape functions when the text had already been escaped or was
not escaped.

* Reformat comment to make drone build happy

* Remove no longer used url library

* Requested code changes
2019-03-18 10:00:23 -04:00
..
activity.go Restrict permission check on repositories and fix some problems (#5314) 2018-11-28 19:26:14 +08:00
attachment.go Log attachment blocked events (#3615) 2018-03-05 08:51:10 +08:00
branch.go branch: Trigger update when deleting branch via UI. (#5617) 2019-01-02 20:56:58 +08:00
commit.go fix commit page showing status for current default branch (#5650) 2019-01-06 16:32:00 +02:00
download.go Allow markdown files to read from the LFS (#5787) 2019-02-12 15:09:43 +00:00
editor.go Refactor editor upload, update and delete to use git plumbing and add LFS support (#5702) 2019-02-12 15:07:31 +02:00
editor_test.go Refactor editor upload, update and delete to use git plumbing and add LFS support (#5702) 2019-02-12 15:07:31 +02:00
http.go In basic auth check for tokens before call UserSignIn (#5725) 2019-02-12 11:20:08 +02:00
issue.go refactor issue indexer, add some testing and fix a bug (#6131) 2019-02-21 08:54:05 +08:00
issue_dependency.go Added dependencies for issues (#2196) (#2531) 2018-07-17 17:23:58 -04:00
issue_label.go Allow labels to contain emoji (#6063) 2019-02-16 19:33:09 +02:00
issue_label_test.go fix go vet error (#3740) 2018-03-30 07:21:27 +08:00
issue_lock.go Implement "conversation lock" for issue comments (#5073) 2019-02-18 22:55:04 +02:00
issue_stopwatch.go Automatically clear stopwatch on merging a PR (#4327) 2019-02-05 13:38:11 +02:00
issue_timetrack.go Handle refactor (#3339) 2018-01-10 23:34:17 +02:00
issue_watch.go Restrict permission check on repositories and fix some problems (#5314) 2018-11-28 19:26:14 +08:00
main_test.go Unit tests for wiki routers (#3022) 2017-11-30 17:52:15 +02:00
middlewares.go Add whitespace handling to PR-comparsion (#4683) 2018-08-14 13:49:33 -04:00
milestone.go Add same changes from issues page to milestone->issues page (#6328) 2019-03-15 11:50:27 -04:00
pull.go Clean up various use of escape/unescape functions for URL generation (#6334) 2019-03-18 10:00:23 -04:00
pull_review.go Add comment replies (#5104) 2018-10-22 16:13:35 -04:00
release.go Feature: Archive repos (#5009) 2019-01-23 13:58:38 -05:00
release_test.go Fix missing branch in release bug (#3108) 2017-12-08 13:22:02 +08:00
repo.go fix bug when migrate repository 500 when repo is existed (#6188) 2019-02-26 09:28:56 -05:00
search.go Global code search support (#3664) 2018-03-16 22:04:33 +08:00
setting.go Create a repo redirect when transferring ownership (#6210) (#6211) 2019-02-28 11:51:46 +08:00
setting_protected_branch.go Approvals at Branch Protection (#5350) 2018-12-11 19:28:37 +08:00
settings_test.go An inactive user shouldn't be able to be added as a collaborator (#4535) 2018-08-07 13:01:06 +03:00
topic.go Fix topics addition (Another solution) (#4031) (#4258) 2018-06-21 17:09:46 +08:00
view.go update git vendor to fix wrong release commit id and add migrations (#6224) 2019-03-11 11:44:58 +08:00
webhook.go Slack webhook channel name cannot be empty or just contain an hashtag (#4786) 2018-09-10 10:31:08 -04:00
wiki.go Fix serving of raw wiki files other than .md (#5814) 2019-02-05 20:58:55 -05:00
wiki_test.go Fix serving of raw wiki files other than .md (#5814) 2019-02-05 20:58:55 -05:00