Merge "Double-encode search query"

This commit is contained in:
Andrew Bonventre
2016-07-15 16:39:33 +00:00
committed by Gerrit Code Review
2 changed files with 9 additions and 1 deletions

View File

@@ -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) {

View File

@@ -71,5 +71,12 @@ limitations under the License.
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>