Skip to content

Commit

Permalink
feat(storage): add s3 storage backend config with SSE-C
Browse files Browse the repository at this point in the history
  • Loading branch information
fugal-dy committed Nov 30, 2023
1 parent 5513141 commit 5bb47e5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion alexandria/core/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ class Meta:
ordering = ["-created_at"]


@receiver(models.signals.pre_delete, sender=File)
@receiver(models.signals.post_delete, sender=File)
def auto_delete_file_on_delete(sender, instance, **kwargs):
"""Delete file from filesystem when `File` object is deleted."""

Expand Down
4 changes: 2 additions & 2 deletions alexandria/core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from alexandria.core.models import File


def create_thumbnail(_file):
def create_thumbnail(_file: File):
with NamedTemporaryFile() as tmp:
temp_file = Path(tmp.name)
manager = PreviewManager(str(temp_file.parent))
Expand All @@ -33,7 +33,7 @@ def create_thumbnail(_file):

with path_to_preview_image.open("rb") as thumb:
thumb_file = File.objects.create(
name=f"{_file.name}.jpg",
name=f"{_file.name}_preview.jpg",
document=_file.document,
variant=File.Variant.THUMBNAIL.value,
original=_file,
Expand Down

0 comments on commit 5bb47e5

Please sign in to comment.