aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyblackbird_cc/resources/views.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py
index 91f2728..bc55842 100644
--- a/pyblackbird_cc/resources/views.py
+++ b/pyblackbird_cc/resources/views.py
@@ -6,6 +6,7 @@ from dataclasses import dataclass
import boto3
from botocore.exceptions import ClientError
+from botocore.utils import Path
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.db import transaction
@@ -43,7 +44,8 @@ class ResourceInfo:
def _extract_metadata_from_resource(resource_obj) -> ResourceInfo | None:
"""
- This function extracts the resource information from the model object and returns it as a ResourceInfo object
+ This function extracts the resource information from the model object and returns it as a
+ ResourceInfo object
:param resource_obj:
:return:
"""
@@ -159,7 +161,7 @@ def upload_to_s3(pdf_files, thumbnail_files, snappedshotted_pages) -> bool:
client.upload_file(
img,
settings.AWS_STORAGE_BUCKET_NAME,
- f"snapshotted_pages/{os.path.basename(img)}",
+ f"snapshotted_pages/{Path(img).name}",
)
else:
for lst in snappedshotted_pages:
@@ -168,7 +170,7 @@ def upload_to_s3(pdf_files, thumbnail_files, snappedshotted_pages) -> bool:
client.upload_file(
img,
settings.AWS_STORAGE_BUCKET_NAME,
- f"snapshotted_pages/{os.path.basename(img)}",
+ f"snapshotted_pages/{Path(img).name}",
)
return True
except ClientError: