Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update templates detection in metadata-mapping #1139

Merged
merged 1 commit into from
May 16, 2024
Merged
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
8 changes: 4 additions & 4 deletions eodag/api/product/metadata_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,7 +888,7 @@ def properties_from_json(
else:
conversion_or_none, path_or_text = value
if isinstance(path_or_text, str):
if re.search(r"({[^{}]+})+", path_or_text):
if re.search(r"({[^{}:]+})+", path_or_text):
templates[metadata] = path_or_text
else:
properties[metadata] = path_or_text
Expand Down Expand Up @@ -922,7 +922,7 @@ def properties_from_json(
conversion_or_none = conversion_or_none[0]

# check if conversion uses variables to format
if re.search(r"({[^{}]+})+", conversion_or_none):
if re.search(r"({[^{}:]+})+", conversion_or_none):
conversion_or_none = conversion_or_none.format(**properties)

properties[metadata] = format_metadata(
Expand Down Expand Up @@ -1106,7 +1106,7 @@ def properties_from_xml(
conversion_or_none = conversion_or_none[0]

# check if conversion uses variables to format
if re.search(r"({[^{}]+})+", conversion_or_none):
if re.search(r"({[^{}:]+})+", conversion_or_none):
conversion_or_none = conversion_or_none.format(**properties)

properties[metadata] = [
Expand All @@ -1128,7 +1128,7 @@ def properties_from_xml(
# formatting resolution using previously successfully resolved properties
# Ignore any transformation specified. If a value is to be passed as is,
# we don't want to transform it further
if re.search(r"({[^{}]+})+", path_or_text):
if re.search(r"({[^{}:]+})+", path_or_text):
templates[metadata] = path_or_text
else:
properties[metadata] = path_or_text
Expand Down
Loading