Skip to content

Commit

Permalink
Return formatted cloudfront url
Browse files Browse the repository at this point in the history
  • Loading branch information
RioKnightleyNHS committed Aug 19, 2024
1 parent 843dfc9 commit 952c496
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions lambdas/services/lloyd_george_stitch_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,13 +194,16 @@ def upload_stitched_lg_record_and_retrieve_presign_url(
presign_url_response = self.s3_service.create_download_presigned_url(
s3_bucket_name=self.lloyd_george_bucket_name, file_key=filename_on_bucket
)
logger.info(presign_url_response)
test_url = presign_url_response.split("/")
logger.info(test_url)
del test_url[0:2]
str.join(test_url)
logger.info(test_url)
return test_url
return self.format_cloudfront_url(presign_url_response)

def format_cloudfront_url(presign_url: str) -> str:
test_url = presign_url.split("/")
formatted_arr = ["/" + s for s in test_url]
del formatted_arr[0:2]
cloudfront_str_arr = ["https://d2k4kp2bsjuisr.cloudfront.net"]
cloudfront_str_arr.extend(formatted_arr)
cloudfront_url = "".join(cloudfront_str_arr)
return cloudfront_url

@staticmethod
def get_most_recent_created_date(documents: list[DocumentReference]) -> str:
Expand Down

0 comments on commit 952c496

Please sign in to comment.