[JENKINS-37020] fix bug where branch name was not decoded (#382)

This commit is contained in:
Cliff Meyers 2016-07-28 22:07:58 -04:00 committed by James William Dumay
parent 39b4ffa0de
commit 36966d4793
2 changed files with 14 additions and 1 deletions

View File

@ -96,7 +96,7 @@ export class PipelineCard extends Component {
{ this.props.branch ?
<span className="branch">
<span className="octicon octicon-git-branch"></span>
<span className="branchText">{this.props.branch}</span>
<span className="branchText">{decodeURIComponent(this.props.branch)}</span>
</span>
:
<span className="branch"></span>

View File

@ -55,4 +55,17 @@ describe('PipelineCard', () => {
assert.equal(wrapper.find('.actions .run').length, 0);
});
it('escapes the branch name', () => {
const branchName = 'feature/JENKINS-667';
const wrapper = shallow(
<PipelineCard status="SUCCESS" organization="Jenkins" pipeline="blueocean"
branch={encodeURIComponent(branchName)} commitId="447d8e1"
/>
);
const elements = wrapper.find('.branchText');
assert.equal(elements.length, 1);
assert.equal(elements.at(0).text(), branchName);
});
});