Skip to content

Commit

Permalink
Merge pull request #2665 from GSA-TTS/main
Browse files Browse the repository at this point in the history
2023-10-31 main -> prod
  • Loading branch information
danswick authored Oct 31, 2023
2 parents ab2dd30 + 37c47a6 commit 165b429
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
19 changes: 14 additions & 5 deletions backend/audit/file_downloads.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from django.conf import settings
from django.http import Http404
from django.shortcuts import get_object_or_404

from boto3 import client as boto3_client
from botocore.client import ClientError, Config
Expand All @@ -14,11 +13,21 @@

def get_filename(sac, file_type):
if file_type == "report":
file_obj = get_object_or_404(SingleAuditReportFile, sac=sac)
return f"singleauditreport/{file_obj.filename}"
try:
file_obj = SingleAuditReportFile.objects.filter(sac=sac).latest(
"date_created"
)
return f"singleauditreport/{file_obj.filename}"
except SingleAuditReportFile.DoesNotExist:
raise Http404()
else:
file_obj = get_object_or_404(ExcelFile, sac=sac, form_section=file_type)
return f"excel/{file_obj.filename}"
try:
file_obj = ExcelFile.objects.filter(sac=sac, form_section=file_type).latest(
"date_created"
)
return f"excel/{file_obj.filename}"
except ExcelFile.DoesNotExist:
raise Http404()


def file_exists(filename):
Expand Down
1 change: 1 addition & 0 deletions backend/config/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
AWS_S3_PRIVATE_ENDPOINT = os.environ.get(
"AWS_S3_PRIVATE_ENDPOINT", "http://minio:9000"
)
AWS_PRIVATE_DEFAULT_ACL = "private"

AWS_S3_ENDPOINT_URL = AWS_S3_PRIVATE_ENDPOINT

Expand Down
1 change: 1 addition & 0 deletions backend/report_submission/storages.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ class S3PrivateStorage(S3Boto3Storage):
bucket_name = settings.AWS_PRIVATE_STORAGE_BUCKET_NAME
access_key = settings.AWS_PRIVATE_ACCESS_KEY_ID
secret_key = settings.AWS_PRIVATE_SECRET_ACCESS_KEY
default_acl = settings.AWS_PRIVATE_DEFAULT_ACL
location = ""

0 comments on commit 165b429

Please sign in to comment.