Merge "Double-encode project name and branch links"

This commit is contained in:
Andrew Bonventre
2016-09-06 16:25:17 +00:00
committed by Gerrit Code Review
2 changed files with 10 additions and 6 deletions

View File

@@ -108,11 +108,15 @@
}, },
_computeProjectURL: function(project) { _computeProjectURL: function(project) {
return '/q/status:open+project:' + project; // @see Issue 4255.
return '/q/status:open+project:' +
encodeURIComponent(encodeURIComponent(project));
}, },
_computeProjectBranchURL: function(project, branch) { _computeProjectBranchURL: function(project, branch) {
return '/q/status:open+project:' + project + '+branch:' + branch; // @see Issue 4255.
return this._computeProjectURL(project) +
'+branch:' + encodeURIComponent(encodeURIComponent(branch));
}, },
}); });
})(); })();

View File

@@ -120,12 +120,12 @@ limitations under the License.
assert.equal(element._computeLabelValue( assert.equal(element._computeLabelValue(
{labels: {Verified: {rejected: true}}}, 'Verified'), '✕'); {labels: {Verified: {rejected: true}}}, 'Verified'), '✕');
assert.equal(element._computeProjectURL('combustible-stuff'), assert.equal(element._computeProjectURL('combustible/stuff'),
'/q/status:open+project:combustible-stuff'); '/q/status:open+project:combustible%252Fstuff');
assert.equal(element._computeProjectBranchURL( assert.equal(element._computeProjectBranchURL(
'combustible-stuff', 'lemons'), 'combustible-stuff', 'le/mons'),
'/q/status:open+project:combustible-stuff+branch:lemons'); '/q/status:open+project:combustible-stuff+branch:le%252Fmons');
element.change = {_number: 42}; element.change = {_number: 42};
assert.equal(element.changeURL, '/c/42/'); assert.equal(element.changeURL, '/c/42/');