Skip to content

Commit fedab94

Browse files
committed
Fix the format links to point to correct location when latest snapshot
is used, also corrects the versions links at the top. - Legacy-Id: 18875
1 parent 84a25ed commit fedab94

2 files changed

Lines changed: 11 additions & 7 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,12 @@ def document_main(request, name, rev=None):
242242
content = doc.text_or_error() # pyflakes:ignore
243243
content = markup_txt.markup(maybe_split(content, split=split_content))
244244

245+
if snapshot:
246+
name = doc.doc.name
247+
else:
248+
name = doc.name
245249
# file types
246-
base_path = os.path.join(settings.INTERNET_DRAFT_PATH, doc.name + "-" + doc.rev + ".")
250+
base_path = os.path.join(settings.INTERNET_DRAFT_PATH, name + "-" + doc.rev + ".")
247251
possible_types = settings.IDSUBMIT_FILE_TYPES
248252
found_types = [t for t in possible_types if os.path.exists(base_path + t)]
249253

@@ -256,13 +260,13 @@ def document_main(request, name, rev=None):
256260
file_urls = []
257261
for t in found_types:
258262
label = "plain text" if t == "txt" else t
259-
file_urls.append((label, base + doc.name + "-" + doc.rev + "." + t))
263+
file_urls.append((label, base + name + "-" + doc.rev + "." + t))
260264

261265
if "pdf" not in found_types:
262-
file_urls.append(("pdf", settings.TOOLS_ID_PDF_URL + doc.name + "-" + doc.rev + ".pdf"))
263-
#file_urls.append(("htmlized", settings.TOOLS_ID_HTML_URL + doc.name + "-" + doc.rev))
264-
file_urls.append(("htmlized (tools)", settings.TOOLS_ID_HTML_URL + doc.name + "-" + doc.rev))
265-
file_urls.append(("htmlized", urlreverse('ietf.doc.views_doc.document_html', kwargs=dict(name=doc.name, rev=doc.rev))))
266+
file_urls.append(("pdf", settings.TOOLS_ID_PDF_URL + name + "-" + doc.rev + ".pdf"))
267+
#file_urls.append(("htmlized", settings.TOOLS_ID_HTML_URL + name + "-" + doc.rev))
268+
file_urls.append(("htmlized (tools)", settings.TOOLS_ID_HTML_URL + name + "-" + doc.rev))
269+
file_urls.append(("htmlized", urlreverse('ietf.doc.views_doc.document_html', kwargs=dict(name=name, rev=doc.rev))))
266270

267271
# latest revision
268272
latest_revision = doc.latest_event(NewRevisionDocEvent, type="new_revision")

ietf/templates/doc/revisions_list.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<li class="disabled"><a><b>Versions</b></a></li>
44
{% for rev in revisions %}
55
<li {% if rev == doc.rev %}{% if snapshot or not doc.get_state_slug == "rfc" %}{% if rev == latest_rev and not doc.get_state_slug == "rfc" %}class="active"{% else %}class="warning"{% endif %}{% endif %}{% endif %}>
6-
<a href="{% url "ietf.doc.views_doc.document_main" name=doc.name %}{{ rev }}/" {% if rev != "00" and rev != latest_rev %}rel="nofollow"{% endif %} >{{ rev }}</a>
6+
<a href="{% if snapshot and doc.get_state_slug == "rfc" %}{% url "ietf.doc.views_doc.document_main" name=doc.doc.name %}{% else %}{% url "ietf.doc.views_doc.document_main" name=doc.name %}{% endif %}{{ rev }}/" {% if rev != "00" and rev != latest_rev %}rel="nofollow"{% endif %} >{{ rev }}</a>
77
</li>
88
{% endfor %}
99
</ul>

0 commit comments

Comments
 (0)