Skip to content

Commit 150ee0a

Browse files
committed
feat: unescape json patch paths when building objects from patches
1 parent 782cd43 commit 150ee0a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Common/Helper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
import React, { SyntheticEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react'
1818
import { JSONPath, JSONPathOptions } from 'jsonpath-plus'
19-
import { compare as compareJSON, applyPatch } from 'fast-json-patch'
19+
import { compare as compareJSON, applyPatch, unescapePathComponent } from 'fast-json-patch'
2020
import { components } from 'react-select'
2121
import * as Sentry from '@sentry/browser'
2222
import moment from 'moment'
@@ -594,7 +594,7 @@ const buildObjectFromPathTokens = (index: number, tokens: string[], value: any)
594594
const isKeyNumber = !Number.isNaN(numberKey)
595595
return isKeyNumber
596596
? [...Array(numberKey).fill(null), buildObjectFromPathTokens(index + 1, tokens, value)]
597-
: { [key]: buildObjectFromPathTokens(index + 1, tokens, value) }
597+
: { [unescapePathComponent(key)]: buildObjectFromPathTokens(index + 1, tokens, value) }
598598
}
599599

600600
/**

0 commit comments

Comments
 (0)