diff --git a/ietf/api/tests.py b/ietf/api/tests.py index 4c1440882..e61069b3f 100644 --- a/ietf/api/tests.py +++ b/ietf/api/tests.py @@ -1080,3 +1080,9 @@ class RfcdiffSupportTests(TestCase): # tricky draft names self.do_rfc_with_broken_history_test(draft_name='draft-gizmo-01') self.do_rfc_with_broken_history_test(draft_name='draft-oh-boy-what-a-draft-02-03') + + def test_no_such_document(self): + for name in ['rfc0000', 'draft-ftei-oof-rab-00']: + url = urlreverse(self.target_view, kwargs={'name': name}) + r = self.client.get(url) + self.assertEqual(r.status_code, 404) diff --git a/ietf/api/views.py b/ietf/api/views.py index df7fdb2c8..9d832f6fa 100644 --- a/ietf/api/views.py +++ b/ietf/api/views.py @@ -327,7 +327,7 @@ def get_previous_url(name, rev=None): def rfcdiff_latest_json(request, name, rev=None): response = dict() condition, document, history, found_rev = find_doc_for_rfcdiff(name, rev) - if document.type_id == "rfc": + if document and document.type_id == "rfc": draft = document.came_from_draft() if condition == 'no such document': raise Http404