|
17 | 17 | import React, { SyntheticEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'
|
18 | 18 | import DOMPurify from 'dompurify'
|
19 | 19 | import { JSONPath, JSONPathOptions } from 'jsonpath-plus'
|
20 |
| -import { compare as compareJSON, applyPatch } from 'fast-json-patch' |
| 20 | +import { compare as compareJSON, applyPatch, unescapePathComponent } from 'fast-json-patch' |
21 | 21 | import { components } from 'react-select'
|
22 | 22 | import * as Sentry from '@sentry/browser'
|
23 | 23 | import moment from 'moment'
|
@@ -595,7 +595,7 @@ const buildObjectFromPathTokens = (index: number, tokens: string[], value: any)
|
595 | 595 | const isKeyNumber = !Number.isNaN(numberKey)
|
596 | 596 | return isKeyNumber
|
597 | 597 | ? [...Array(numberKey).fill(null), buildObjectFromPathTokens(index + 1, tokens, value)]
|
598 |
| - : { [key]: buildObjectFromPathTokens(index + 1, tokens, value) } |
| 598 | + : { [unescapePathComponent(key)]: buildObjectFromPathTokens(index + 1, tokens, value) } |
599 | 599 | }
|
600 | 600 |
|
601 | 601 | /**
|
@@ -644,10 +644,7 @@ export const powerSetOfSubstringsFromStart = (strings: string[], regex: RegExp)
|
644 | 644 | })
|
645 | 645 |
|
646 | 646 | export const convertJSONPointerToJSONPath = (pointer: string) =>
|
647 |
| - pointer |
648 |
| - .replace(/\/([\*0-9]+)\//g, '[$1].') |
649 |
| - .replace(/\//g, '.') |
650 |
| - .replace(/\./, '$.') |
| 647 | + unescapePathComponent(pointer.replace(/\/([\*0-9]+)\//g, '[$1].').replace(/\//g, '.').replace(/\./, '$.')) |
651 | 648 |
|
652 | 649 | export const flatMapOfJSONPaths = (
|
653 | 650 | paths: string[],
|
|
0 commit comments