gitbucket icon indicating copy to clipboard operation
gitbucket copied to clipboard

Integration with Slack sends message with broken link if branch name has a slash character

Open nbkhope opened this issue 7 years ago • 1 comments

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:1 feature/do-something

console.log(encodeURIComponent('feature/do-something')) VM167:1 feature%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:

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

LINK: https://www.some.where/gitbucket/some-group/some-repository/tree/feature%2Fdo-something

nbkhope avatar Mar 24 '17 17:03 nbkhope

@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.

ghost avatar May 06 '17 05:05 ghost