Skip to content

Commit bcca519

Browse files
authored
fix: Fix document not found bug in rfcdiff API (ietf-tools#6681)
Fixes ietf-tools#6675
1 parent 2137dd8 commit bcca519

2 files changed

Lines changed: 7 additions & 1 deletion

File tree

ietf/api/tests.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1080,3 +1080,9 @@ def test_rfc_with_broken_history(self):
10801080
# tricky draft names
10811081
self.do_rfc_with_broken_history_test(draft_name='draft-gizmo-01')
10821082
self.do_rfc_with_broken_history_test(draft_name='draft-oh-boy-what-a-draft-02-03')
1083+
1084+
def test_no_such_document(self):
1085+
for name in ['rfc0000', 'draft-ftei-oof-rab-00']:
1086+
url = urlreverse(self.target_view, kwargs={'name': name})
1087+
r = self.client.get(url)
1088+
self.assertEqual(r.status_code, 404)

ietf/api/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ def get_previous_url(name, rev=None):
327327
def rfcdiff_latest_json(request, name, rev=None):
328328
response = dict()
329329
condition, document, history, found_rev = find_doc_for_rfcdiff(name, rev)
330-
if document.type_id == "rfc":
330+
if document and document.type_id == "rfc":
331331
draft = document.came_from_draft()
332332
if condition == 'no such document':
333333
raise Http404

0 commit comments

Comments
 (0)