Commit db6e6d9d authored by Merlijn Wajer's avatar Merlijn Wajer
Browse files

scandata: ensure that returned path is a string

parent c6a57ee7
......@@ -18,7 +18,7 @@ def get_scandata_xml(identifier, source_file):
* identifier (str): Identifier of the item
* source_file (str): sourceFile to be operated on
Returns the path to the scandata (str).
Returns the path to the scandata (str) or None
"""
item_dir = Path(PB_ITEM)
......@@ -32,11 +32,11 @@ def get_scandata_xml(identifier, source_file):
source_xml_path = Path(f'{source_file.rsplit("_", 1)[0]}_scandata.xml')
if source_xml_path.exists():
return source_xml_path
return str(source_xml_path)
elif identifier_xml_path.exists():
return identifier_xml_path
return str(identifier_xml_path)
elif raw_xml_path.exists():
return raw_xml_path
return str(raw_xml_path)
elif zip_path.exists():
try:
# XXX: We don't clean up the temporary directory when we're done,
......@@ -50,7 +50,7 @@ def get_scandata_xml(identifier, source_file):
logger.warning('Unable to extract scandata.xml from scandata.zip')
logger.exception(e)
return None
return xml_path
return str(xml_path)
logger.warning(f'Unable to find scandata file')
return None
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment