Skip to content

Commit

Permalink
Merge pull request #29 from nationalarchives/handle-null-uri-in-json
Browse files Browse the repository at this point in the history
Handle case where URI is null in the JSON file
  • Loading branch information
LewisDaleUK authored May 5, 2022
2 parents ff3ec6c + 4141571 commit 2d1dbac
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ds-caselaw-ingester/lambda_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ class MaximumRetriesExceededException(Exception):


def extract_uri(metadata: dict, consignment_reference: str) -> str:
uri = metadata["parameters"]["PARSER"].get("uri", "").replace('https://caselaw.nationalarchives.gov.uk/id/', '')
uri = metadata["parameters"]["PARSER"].get("uri", "")

if not uri:
uri = f'failures/{consignment_reference}'

return uri
return uri.replace('https://caselaw.nationalarchives.gov.uk/id/', '')


def extract_docx_filename(metadata: dict) -> str:
Expand Down

0 comments on commit 2d1dbac

Please sign in to comment.