From e910836ad4fe06c2c4c9fadbe1bf01ed90b1eb98 Mon Sep 17 00:00:00 2001
From: Robert Sparks <rjsparks@nostrum.com>
Date: Mon, 26 Jun 2023 19:33:02 -0500
Subject: [PATCH] fix: teach build_file_urls about rfc type documents. (#5880)

---
 ietf/doc/utils.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ietf/doc/utils.py b/ietf/doc/utils.py
index 4d4e91ea7..7d55fa676 100644
--- a/ietf/doc/utils.py
+++ b/ietf/doc/utils.py
@@ -1000,10 +1000,10 @@ def get_search_cache_key(params):
     return key
     
 def build_file_urls(doc: Union[Document, DocHistory]):
-    if doc.type_id != 'draft':
+    if doc.type_id not in  ['draft', 'rfc']:
         return [], []
 
-    if doc.is_rfc():
+    if doc.type_id == "rfc":
         name = doc.canonical_name()
         base_path = os.path.join(settings.RFC_PATH, name + ".")
         possible_types = settings.RFC_FILE_TYPES
@@ -1039,6 +1039,7 @@ def build_file_urls(doc: Union[Document, DocHistory]):
             file_urls.append(("pdfized", urlreverse('ietf.doc.views_doc.document_pdfized', kwargs=dict(name=doc.name, rev=doc.rev))))
         file_urls.append(("bibtex", urlreverse('ietf.doc.views_doc.document_bibtex',kwargs=dict(name=doc.name,rev=doc.rev))))
     else:
+        # TODO: look at the state of the database post migration and update this comment, or remove the block
         # As of 2022-12-14, there are 1463 Document and 3136 DocHistory records with type='draft' and rev=''.
         # All of these are in the rfc state and are covered by the above cases.
         log.unreachable('2022-12-14')