Skip to content

Commit

Permalink
fix line formatting #81
Browse files Browse the repository at this point in the history
  • Loading branch information
asuresh-code committed Jan 14, 2025
1 parent b21b555 commit 9825c64
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion object_storage_api/services/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ def update(self, image_id: str, image: ImagePatchMetadataSchema) -> ImageMetadat
f"Patch filename extension `{image.file_name}` does not match"
f"stored image `{stored_image.file_name}`"
)

update_primary = image.primary is not None and image.primary is True and stored_image.primary is False
updated_image = self._image_repository.update(
image_id=image_id,
Expand Down
13 changes: 2 additions & 11 deletions object_storage_api/stores/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@ class ImageStore:
Store for managing images in an S3 object store.
"""

def upload(
self,
image_id: str,
image_metadata: ImagePostMetadataSchema,
upload_file: UploadFile,
) -> str:
def upload(self, image_id: str, image_metadata: ImagePostMetadataSchema, upload_file: UploadFile) -> str:
"""
Uploads a given image to object storage.
Expand Down Expand Up @@ -51,17 +46,13 @@ def create_presigned_get(self, image: ImageOut) -> str:
:param image: `ImageOut` model of the image.
:return: Presigned url to get the image.
"""
logger.info(
"Generating presigned url to get image with object key: %s from the object store",
image.object_key,
)
logger.info("Generating presigned url to get image with object key: %s from the object store", image.object_key)
response = s3_client.generate_presigned_url(
"get_object",
Params={
"Bucket": object_storage_config.bucket_name.get_secret_value(),
"Key": image.object_key,
"ResponseContentDisposition": f'inline; filename="{image.file_name}"',
"ResponseContentType": "application/octet-stream",
},
ExpiresIn=object_storage_config.presigned_url_expiry_seconds,
)
Expand Down
1 change: 0 additions & 1 deletion test/unit/stores/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ def check_create_presigned_get_success(self) -> None:
"Bucket": object_storage_config.bucket_name.get_secret_value(),
"Key": self._image_out.object_key,
"ResponseContentDisposition": f'inline; filename="{self._image_out.file_name}"',
"ResponseContentType": "application/octet-stream",
},
ExpiresIn=object_storage_config.presigned_url_expiry_seconds,
)
Expand Down

0 comments on commit 9825c64

Please sign in to comment.