Skip to content

Commit

Permalink
handle case where xpath resolves to text not element
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonDavis committed May 23, 2024
1 parent be25d8a commit fedee23
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion sde_collections/utils/title_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ def resolve_xpath(xpath: str, url: str) -> str:
values = tree.xpath(xpath)

if len(values) == 1:
text_content = values[0].text
if isinstance(values[0], str):
text_content = values[0]
else:
text_content = values[0].text

if text_content:
text_content = clean_text(text_content)
return text_content
Expand Down

0 comments on commit fedee23

Please sign in to comment.