Escape characters in location.hash correctly

This commit is contained in:
Shaunak Kishore
2018-02-10 21:06:03 -05:00
parent 16fda2d4f0
commit 90bdc0fd27

View File

@ -28,7 +28,7 @@ const changeGlyph = (method, argument) => {
Meteor.call(method, argument, function(error, data) { Meteor.call(method, argument, function(error, data) {
assert(!error, error); assert(!error, error);
Session.set('editor.glyph', data); Session.set('editor.glyph', data);
window.location.hash = data.character; window.location.hash = encodeURIComponent(data.character);
}); });
} }
@ -95,7 +95,7 @@ const incrementStage = (amount) => {
} }
const loadCharacter = () => { const loadCharacter = () => {
const character = window.location.hash[1]; const character = decodeURIComponent(window.location.hash.slice(1));
const glyph = Session.get('editor.glyph'); const glyph = Session.get('editor.glyph');
if (!character) { if (!character) {
changeGlyph('getNextGlyph'); changeGlyph('getNextGlyph');