diff --git a/public/app/core/utils/explore.test.ts b/public/app/core/utils/explore.test.ts index fc239661fa8..cc0c14ee176 100644 --- a/public/app/core/utils/explore.test.ts +++ b/public/app/core/utils/explore.test.ts @@ -36,8 +36,7 @@ describe('state functions', () => { }); it('returns a valid Explore state from URL parameter', () => { - const paramValue = - '%7B"datasource":"Local","queries":%5B%7B"expr":"metric"%7D%5D,"range":%7B"from":"now-1h","to":"now"%7D%7D'; + const paramValue = '{"datasource":"Local","queries":[{"expr":"metric"}],"range":{"from":"now-1h","to":"now"}}'; expect(parseUrlState(paramValue)).toMatchObject({ datasource: 'Local', queries: [{ expr: 'metric' }], @@ -49,9 +48,7 @@ describe('state functions', () => { }); it('returns a valid Explore state from a compact URL parameter', () => { - // ["now-1h","now","Local",{"expr":"metric"},{"ui":[true,true,true,"none"]}] - const paramValue = - '%5B"now-1h","now","Local",%7B"expr":"metric"%7D,%7B%22ui%22:%5Btrue,true,true,%22none%22%5D%7D%5D'; + const paramValue = '["now-1h","now","Local",{"expr":"metric"},{"ui":[true,true,true,"none"]}]'; expect(parseUrlState(paramValue)).toMatchObject({ datasource: 'Local', queries: [{ expr: 'metric' }], @@ -63,9 +60,8 @@ describe('state functions', () => { }); it('should return queries if queryType is present in the url', () => { - // ["now-1h","now","x-ray-datasource",{"queryType":"getTraceSummaries"},{"ui":[true,true,true,"none"]}] const paramValue = - '%5B"now-1h","now","x-ray-datasource",%7B"queryType":"getTraceSummaries"%7D,%7B%22ui%22:%5Btrue,true,true,%22none%22%5D%7D%5D'; + '["now-1h","now","x-ray-datasource",{"queryType":"getTraceSummaries"},{"ui":[true,true,true,"none"]}]'; expect(parseUrlState(paramValue)).toMatchObject({ datasource: 'x-ray-datasource', queries: [{ queryType: 'getTraceSummaries' }], diff --git a/public/app/core/utils/explore.ts b/public/app/core/utils/explore.ts index d2f3edbc691..691b1d93a9d 100644 --- a/public/app/core/utils/explore.ts +++ b/public/app/core/utils/explore.ts @@ -194,7 +194,7 @@ export const safeParseJson = (text?: string): any | undefined => { } try { - return JSON.parse(decodeURI(text)); + return JSON.parse(text); } catch (error) { console.error(error); }