Skip to content

Commit c44c8a0

Browse files
committed
Merged in [18857] from housley@vigilsec.com:
Properly handle bibxml3 for drafts with filenames that end in a hypen and digits. Fixes ietf-tools#3188. - Legacy-Id: 18870 Note: SVN reference [18857] has been migrated to Git commit cb554fa
2 parents 87489c8 + cb554fa commit c44c8a0

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

ietf/doc/views_doc.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,11 @@ def document_history(request, name):
832832

833833

834834
def document_bibtex(request, name, rev=None):
835+
# If URL_REGEXPS put trailing digits in rev, they must be two digits
836+
if rev != None and len(rev) != 2:
837+
name = name+"-"+rev
838+
rev = None
839+
835840
doc = get_object_or_404(Document, docalias__name=name)
836841

837842
latest_revision = doc.latest_event(NewRevisionDocEvent, type="new_revision")
@@ -870,13 +875,22 @@ def document_bibxml_ref(request, name, rev=None):
870875
raise Http404()
871876
if not name.startswith('draft-'):
872877
name = 'draft-'+name
878+
if rev != None and len(rev) != 2:
879+
name = name+"-"+rev
880+
rev = None
873881
return document_bibxml(request, name, rev=rev)
874882

875883
def document_bibxml(request, name, rev=None):
876884
# This only deals with drafts, as bibxml entries for RFCs should come from
877885
# the RFC-Editor.
878886
if re.search(r'^rfc\d+$', name):
879887
raise Http404()
888+
889+
# If URL_REGEXPS put trailing digits in rev, they must be two digits
890+
if rev != None and len(rev) != 2:
891+
name = name+"-"+rev
892+
rev = None
893+
880894
doc = get_object_or_404(Document, name=name, type_id='draft')
881895

882896
latest_revision = doc.latest_event(NewRevisionDocEvent, type="new_revision")

0 commit comments

Comments
 (0)