1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 12:54:53 -05:00
forgejo/routers
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
..
admin Show private organization for admin, fix #6111 (#6112) 2019-02-19 09:16:06 +08:00
api/v1 Return 409 when creating repo if it already exists. (#6330) 2019-03-15 10:19:09 -04:00
dev Make time diff translatable (#2057) 2017-06-28 13:43:28 +08:00
org fix bug when update owner team then visit team's repo return 404 (#6119) 2019-02-22 11:14:45 -05:00
private Clean up various use of escape/unescape functions for URL generation (#6334) 2019-03-18 10:00:23 -04:00
repo Clean up various use of escape/unescape functions for URL generation (#6334) 2019-03-18 10:00:23 -04:00
routes Add same changes from issues page to milestone->issues page (#6328) 2019-03-15 11:50:27 -04:00
user Add support for client basic auth for exchanging access tokens (#6293) 2019-03-11 10:54:59 +08:00
utils Slack webhook channel name cannot be empty or just contain an hashtag (#4786) 2018-09-10 10:31:08 -04:00
home.go Clean up various use of escape/unescape functions for URL generation (#6334) 2019-03-18 10:00:23 -04:00
init.go refactor issue indexer, add some testing and fix a bug (#6131) 2019-02-21 08:54:05 +08:00
install.go Integrate OAuth2 Provider (#5378) 2019-03-08 11:42:50 -05:00
metrics.go Fix metrics auth token detection (#6006) 2019-02-09 00:58:31 -05:00
swagger_json.go Swagger.v1.json template (#3572) 2018-07-28 03:19:01 +03:00