Skip to content

Commit 6ad151f

Browse files
authored
Merge pull request openwallet-foundation#4082 from jamshale/1.2.lts
chore: bump jsonpath-ng to 1.8.0 and fix full_path format
2 parents e362a10 + 46e9e1e commit 6ad151f

File tree

3 files changed

+14
-24
lines changed

3 files changed

+14
-24
lines changed

acapy_agent/protocols/present_proof/dif/pres_exch_handler.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@
6767
PRESENTATION_SUBMISSION_JSONLD_TYPE = "PresentationSubmission"
6868
PYTZ_TIMEZONE_PATTERN = re.compile(r"(([a-zA-Z]+)(?:\/)([a-zA-Z]+))")
6969
LIST_INDEX_PATTERN = re.compile(r"\[(\W+)\]|\[(\d+)\]")
70+
# jsonpath-ng 1.8+ uses parentheses in str(full_path); normalize to "a.b.c"
71+
JSONPATH_FULL_PATH_PARENS = re.compile(r"[()]")
72+
7073
LOGGER = logging.getLogger(__name__)
7174

7275

@@ -526,7 +529,9 @@ def reveal_doc(self, credential_dict: dict, constraints: Constraints):
526529
if len(match) == 0:
527530
continue
528531
for match_item in match:
529-
full_path = str(match_item.full_path)
532+
full_path = JSONPATH_FULL_PATH_PARENS.sub(
533+
"", str(match_item.full_path)
534+
)
530535
if bool(LIST_INDEX_PATTERN.search(full_path)):
531536
full_path = re.sub(r"\[(\W+)\]|\[(\d+)\]", "[0]", full_path)
532537
full_path = full_path.replace(".[", "[")
@@ -1582,7 +1587,7 @@ def update_path_recursive_call(path: str, level: int = 0):
15821587
to_check = path_split_array[-1]
15831588
if "." not in to_check:
15841589
return path
1585-
split_by_index = re.split(r"\[(\d+)\]", to_check, 1)
1590+
split_by_index = re.split(r"\[(\d+)\]", to_check, maxsplit=1)
15861591
if len(split_by_index) > 1:
15871592
jsonpath = parse(split_by_index[0])
15881593
match = jsonpath.find(cred_dict)

poetry.lock

Lines changed: 6 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ base58 = "~2.1.0"
2525
ConfigArgParse = "~1.7"
2626
deepmerge = "~0.3.0"
2727
ecdsa = "~0.19.0"
28-
jsonpath-ng = "1.7.0"
28+
jsonpath-ng = "1.8.0"
2929
Markdown = "~3.7"
3030
markupsafe = "2.1.5"
3131
marshmallow = "~3.25.1"

0 commit comments

Comments
 (0)