Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions acapy_agent/protocols/present_proof/dif/pres_exch_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@
PRESENTATION_SUBMISSION_JSONLD_TYPE = "PresentationSubmission"
PYTZ_TIMEZONE_PATTERN = re.compile(r"(([a-zA-Z]+)(?:\/)([a-zA-Z]+))")
LIST_INDEX_PATTERN = re.compile(r"\[(\W+)\]|\[(\d+)\]")
# jsonpath-ng 1.8+ uses parentheses in str(full_path); normalize to "a.b.c"
JSONPATH_FULL_PATH_PARENS = re.compile(r"[()]")

LOGGER = logging.getLogger(__name__)


Expand Down Expand Up @@ -526,7 +529,9 @@ def reveal_doc(self, credential_dict: dict, constraints: Constraints):
if len(match) == 0:
continue
for match_item in match:
full_path = str(match_item.full_path)
full_path = JSONPATH_FULL_PATH_PARENS.sub(
"", str(match_item.full_path)
)
if bool(LIST_INDEX_PATTERN.search(full_path)):
full_path = re.sub(r"\[(\W+)\]|\[(\d+)\]", "[0]", full_path)
full_path = full_path.replace(".[", "[")
Expand Down Expand Up @@ -1601,7 +1606,7 @@ def update_path_recursive_call(path: str, level: int = 0):
to_check = path_split_array[-1]
if "." not in to_check:
return path
split_by_index = re.split(r"\[(\d+)\]", to_check, 1)
split_by_index = re.split(r"\[(\d+)\]", to_check, maxsplit=1)
if len(split_by_index) > 1:
jsonpath = parse(split_by_index[0])
match = jsonpath.find(cred_dict)
Expand Down
26 changes: 4 additions & 22 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ base58 = "~2.1.0"
canonicaljson = "^2.0.0"
ConfigArgParse = "~1.7"
deepmerge = "^2.0"
jsonpath-ng = "^1.7.0"
jsonpath-ng = "^1.8.0"
Markdown = ">=3.7,<3.11"
markupsafe = "^3.0.2"
marshmallow = "~3.26.1"
Expand Down
Loading