Merge "Double-encode search query"
diff --git a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js
index bef461d..7970169 100644
--- a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js
+++ b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar.js
@@ -54,7 +54,8 @@
_preventDefaultAndNavigateToInputVal: function(e) {
e.preventDefault();
Polymer.dom(e).rootTarget.blur();
- page.show('/q/' + this._inputVal);
+ // @see Issue 4255.
+ page.show('/q/' + encodeURIComponent(encodeURIComponent(this._inputVal)));
},
_handleKey: function(e) {
diff --git a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html
index 84752e4..daa0c1a 100644
--- a/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html
+++ b/polygerrit-ui/app/elements/core/gr-search-bar/gr-search-bar_test.html
@@ -71,5 +71,12 @@
MockInteractions.pressAndReleaseKeyOn(element.$.searchInput, 13);
});
+ test('search query should be double-escaped', function() {
+ var showStub = sinon.stub(page, 'show');
+ element._inputVal = 'fate/stay';
+ MockInteractions.pressAndReleaseKeyOn(element.$.searchInput, 13);
+ assert.equal(showStub.lastCall.args[0], '/q/fate%252Fstay');
+ showStub.restore();
+ });
});
</script>