Problem description:
Every time I push a branch to GitBucket, a notification message is posted on a Slack channel. That message has a link that points to the branch. If the branch name has a slash character, like feature/some-branch-name, the link is broken because the slash becomes a %2F. To illustrate that, using the JavaScript encodeURI & encodeURIComponent functions:
I'm not sure exactly whose problem this is -- of GitBucket or of Slack. Whoever is creating the link seems to be encoding the slash in the branch name to %2F.
Message in Slack:
github APP [9:46 AM]
[some-repository:feature/do-something] (<-- broken link) 1 new commit by Some One:
`52a9b52` Add missing parameters to main function - Some One
@nbkhope Slack does the URL encoding, but this is usually not a problem.
Are you running GitBucket behind an HTTP server? As an example, Apache's mod_rewrite have troublesome problems such as multiple URL encoding.
Issue
Impacted version: 4.9.0
Problem description: Every time I push a branch to GitBucket, a notification message is posted on a Slack channel. That message has a link that points to the branch. If the branch name has a slash character, like
feature/some-branch-name
, the link is broken because the slash becomes a%2F
. To illustrate that, using the JavaScript encodeURI & encodeURIComponent functions:console.log(
encodeURI('feature/do-something')
) VM161:1feature/do-something
console.log(
encodeURIComponent('feature/do-something')
) VM167:1feature%2Fdo-something
I'm not sure exactly whose problem this is -- of GitBucket or of Slack. Whoever is creating the link seems to be encoding the slash in the branch name to %2F.
Message in Slack:
LINK:
https://www.some.where/gitbucket/some-group/some-repository/tree/feature%2Fdo-something