Skip to content

Commit

Permalink
Fix stack trace information exposure on library storage failure
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed May 3, 2024
1 parent 3f87144 commit 6a0c87a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion backend/library/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@
StoredLibrarySerializer,
)

import structlog

logger = structlog.get_logger(__name__)


class StoredLibraryViewSet(BaseModelViewSet):
parser_classes = [FileUploadParser]
Expand Down Expand Up @@ -118,8 +122,9 @@ def upload_library(self, request):
try:
StoredLibrary.store_library_content(content)
except ValueError as e:
logger.error("Failed to store library content", error=e)
return HttpResponse(
json.dumps({"error": e}),
json.dumps({"error": "Failed to store library content"}),
status=HTTP_422_UNPROCESSABLE_ENTITY,
)

Expand Down

0 comments on commit 6a0c87a

Please sign in to comment.