Do not encode "," when redirecting /projects/ -> /repos/
Bug: Issue 11096 Change-Id: Id3eb92254f25e8e86568be50c11e60d1a6835af9
This commit is contained in:
@@ -1092,11 +1092,16 @@
|
|||||||
},
|
},
|
||||||
|
|
||||||
_handleProjectsOldRoute(data) {
|
_handleProjectsOldRoute(data) {
|
||||||
|
let params = '';
|
||||||
if (data.params[1]) {
|
if (data.params[1]) {
|
||||||
this._redirect('/admin/repos/' + encodeURIComponent(data.params[1]));
|
params = encodeURIComponent(data.params[1]);
|
||||||
} else {
|
if (data.params[1].includes(',')) {
|
||||||
this._redirect('/admin/repos');
|
params =
|
||||||
|
encodeURIComponent(data.params[1]).replace('%2C', ',');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this._redirect(`/admin/repos/${params}`);
|
||||||
},
|
},
|
||||||
|
|
||||||
_handleRepoCommandsRoute(data) {
|
_handleRepoCommandsRoute(data) {
|
||||||
|
@@ -1100,6 +1100,28 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
|
|
||||||
suite('repo routes', () => {
|
suite('repo routes', () => {
|
||||||
|
test('_handleProjectsOldRoute', () => {
|
||||||
|
const data = {params: {}};
|
||||||
|
element._handleProjectsOldRoute(data);
|
||||||
|
assert.isTrue(redirectStub.calledOnce);
|
||||||
|
assert.equal(redirectStub.lastCall.args[0], '/admin/repos/');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('_handleProjectsOldRoute test', () => {
|
||||||
|
const data = {params: {1: 'test'}};
|
||||||
|
element._handleProjectsOldRoute(data);
|
||||||
|
assert.isTrue(redirectStub.calledOnce);
|
||||||
|
assert.equal(redirectStub.lastCall.args[0], '/admin/repos/test');
|
||||||
|
});
|
||||||
|
|
||||||
|
test('_handleProjectsOldRoute test,branches', () => {
|
||||||
|
const data = {params: {1: 'test,branches'}};
|
||||||
|
element._handleProjectsOldRoute(data);
|
||||||
|
assert.isTrue(redirectStub.calledOnce);
|
||||||
|
assert.equal(
|
||||||
|
redirectStub.lastCall.args[0], '/admin/repos/test,branches');
|
||||||
|
});
|
||||||
|
|
||||||
test('_handleRepoRoute', () => {
|
test('_handleRepoRoute', () => {
|
||||||
const data = {params: {0: 4321}};
|
const data = {params: {0: 4321}};
|
||||||
assertDataToParams(data, '_handleRepoRoute', {
|
assertDataToParams(data, '_handleRepoRoute', {
|
||||||
|
Reference in New Issue
Block a user