From 46dcdef043ebb46c49b6a2717fbe99fa803c219b Mon Sep 17 00:00:00 2001 From: GOTO Hayato <3532528+gh640@users.noreply.github.com> Date: Wed, 8 Aug 2018 01:24:46 +0900 Subject: [PATCH] Issue #452: Fix 500 error with `%` in `code`. (#453) * Issue #452: Fix 500 error with `%` in `code`. * Issue #452: Revert the unnecessary change in `serializeState()`. * encodeURI -> encodeURIComponent --- lib/routing.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/lib/routing.js b/lib/routing.js index 73665fd..46231fd 100644 --- a/lib/routing.js +++ b/lib/routing.js @@ -80,7 +80,6 @@ export const getQueryStringState = query => { } const state = mapper.map(mappings, query) - deserializeCode(state) Object.keys(state).forEach(key => { if (state[key] === '') state[key] = undefined @@ -92,19 +91,9 @@ export const getQueryStringState = query => { export const updateQueryString = state => { if (history.location.search.indexOf('react_perf') < 0) { const mappedState = mapper.map(reverseMappings, state) - serializeCode(mappedState) history.replace({ - search: encodeURI(keysToQuery(mappedState)) + search: encodeURIComponent(keysToQuery(mappedState)) }) } } - -// private -function serializeCode(state) { - if (state.code) state.code = encodeURIComponent(state.code) -} - -function deserializeCode(state) { - if (state.code) state.code = decodeURIComponent(state.code) -}