Skip to content

Commit

Permalink
[bugfix] Protect validator against empty mapped page (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbarahui authored Nov 28, 2023
1 parent 3eb4823 commit 45230bf
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion metadata_mapper/validate_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,14 @@ def validate_page(collection_id: int, page_path: str,
"collection_id": collection_id,
"page_path": page_path
}
collection = get_mapped_page_content(page_path)

if len(collection) == 0:
print(f"No mapped metadata found for {collection_id} page {page_path}. Aborting.")
return

mapped_metadata = validator.generate_keys(
get_mapped_page_content(page_path),
collection,
type="Rikolti",
context=context
)
Expand Down

0 comments on commit 45230bf

Please sign in to comment.