From 3680bf53850c7f850071a46f4a02ab935b76b274 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Tue, 20 Apr 2021 20:34:22 +0200
Subject: [PATCH] Debug submission view if no submission in thread is public

---
 submissions/views.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/submissions/views.py b/submissions/views.py
index 28008f714..a754173b8 100644
--- a/submissions/views.py
+++ b/submissions/views.py
@@ -409,6 +409,8 @@ def submission_detail_wo_vn_nr(request, identifier_wo_vn_nr):
     submissions = get_list_or_404(
         Submission, preprint__identifier_w_vn_nr__startswith=identifier_wo_vn_nr)
     latest = submissions[0].get_latest_version()
+    if not latest: # this can happen if there exists no public version in this thread
+        raise Http404
     return redirect(reverse('submissions:submission',
                             kwargs={ 'identifier_w_vn_nr': latest.preprint.identifier_w_vn_nr }))
 
-- 
GitLab