Merge "Properly encode file path in diff view"

This commit is contained in:
Viktar Donich 2016-11-02 02:58:29 +00:00 committed by Gerrit Code Review
commit 0340226dd9
3 changed files with 11 additions and 1 deletions

View File

@ -16,6 +16,7 @@ limitations under the License.
<link rel="import" href="../../../bower_components/polymer/polymer.html">
<link rel="import" href="../../../bower_components/iron-dropdown/iron-dropdown.html">
<link rel="import" href="../../../behaviors/gr-url-encoding-behavior.html">
<link rel="import" href="../../../behaviors/keyboard-shortcut-behavior.html">
<link rel="import" href="../../../behaviors/rest-client-behavior.html">
<link rel="import" href="../../shared/gr-button/gr-button.html">

View File

@ -92,6 +92,7 @@
behaviors: [
Gerrit.KeyboardShortcutBehavior,
Gerrit.RESTClientBehavior,
Gerrit.URLEncodingBehavior,
],
observers: [
@ -389,7 +390,7 @@
_getDiffURL: function(changeNum, patchRange, path) {
return '/c/' + changeNum + '/' + this._patchRangeStr(patchRange) + '/' +
path;
this.encodeURL(path, true);
},
_computeDiffURL: function(changeNum, patchRangeRecord, path) {

View File

@ -590,5 +590,13 @@ limitations under the License.
assert.isTrue(replaceStateStub.called);
});
test('_getDiffURL encodes special characters', function() {
var changeNum = 123;
var patchRange = {basePatchNum: 123, patchNum: 456};
var path = 'c++/cpp.cpp';
assert.equal(element._getDiffURL(changeNum, patchRange, path),
'/c/123/123..456/c%252B%252B/cpp.cpp');
});
});
</script>