Skip to content

Commit

Permalink
feat: redirect user trying to delete failed document upload
Browse files Browse the repository at this point in the history
  • Loading branch information
nboyse committed Feb 20, 2025
1 parent 07213cf commit 2e409c1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions django_app/redbox_app/redbox_core/views/document_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,17 @@ def remove_doc_view(request, doc_id: uuid):
if request.method == "POST":
try:
file.delete_from_elastic()
file.delete_from_s3()
file.status = File.Status.deleted
file.save()
logger.info("Removing document: %s", request.POST["doc_id"])
except Exception as e:
logger.exception("Error deleting file object %s.", file, exc_info=e)
errors.append("There was an error deleting this file")
file.status = File.Status.errored
file.save()
else:
logger.info("Removing document: %s", request.POST["doc_id"])
file.delete_from_s3()
file.status = File.Status.deleted
file.save()
return redirect("documents")

return redirect("documents")

return render(
request,
Expand Down

0 comments on commit 2e409c1

Please sign in to comment.