[JENKINS-37020] fix bug where branch name was not decoded (#382)
This commit is contained in:
parent
39b4ffa0de
commit
36966d4793
|
@ -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>
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue