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
main
GOTO Hayato 6 years ago committed by Michael Fix
parent b49662cd1d
commit 46dcdef043

@ -80,7 +80,6 @@ export const getQueryStringState = query => {
} }
const state = mapper.map(mappings, query) const state = mapper.map(mappings, query)
deserializeCode(state)
Object.keys(state).forEach(key => { Object.keys(state).forEach(key => {
if (state[key] === '') state[key] = undefined if (state[key] === '') state[key] = undefined
@ -92,19 +91,9 @@ export const getQueryStringState = query => {
export const updateQueryString = state => { export const updateQueryString = state => {
if (history.location.search.indexOf('react_perf') < 0) { if (history.location.search.indexOf('react_perf') < 0) {
const mappedState = mapper.map(reverseMappings, state) const mappedState = mapper.map(reverseMappings, state)
serializeCode(mappedState)
history.replace({ 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)
}

Loading…
Cancel
Save