Skip to content

Commit

Permalink
✨ feat(s3): allow for specifying bucketname withing the url
Browse files Browse the repository at this point in the history
  • Loading branch information
sladg committed Dec 12, 2023
1 parent d4cfb07 commit 8b8d57e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions imaginex_lambda/lib/img_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,9 @@ def download_and_optimize(url: str,
with TemporaryFile() as buffer:
if is_absolute(url):
buffer, _ = download_image(buffer, url, chunk_size)
if url.startswith('s3://'):
bucket_name, key = url[len('s3://'):].split('/', 1)
buffer, _ = get_s3_image(buffer, bucket_name, key, chunk_size)
else:
key = url.strip('/')
buffer, _ = get_s3_image(buffer, bucket_name, key, chunk_size)
Expand Down

0 comments on commit 8b8d57e

Please sign in to comment.