Skip to content

Commit

Permalink
fix: Ignore failure to extract text draft title unless it is needed
Browse files Browse the repository at this point in the history
  • Loading branch information
jennifer-richards committed May 31, 2023
1 parent 5dbf933 commit bf3229b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions ietf/submit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1216,10 +1216,6 @@ def process_submission_text(filename, revision):
title = text_draft.get_title()
if title:
title = _normalize_title(title)
if not title:
# This test doesn't work well - the text_draft parser tends to grab "Abstract" as
# the title if there's an empty title.
raise SubmissionError("Could not extract a title from the text")

# Drops \r, \n, <, >. Based on get_draft_meta() behavior
trans_table = str.maketrans("", "", "\r\n<>")
Expand All @@ -1235,7 +1231,7 @@ def process_submission_text(filename, revision):
return {
"filename": text_draft.filename,
"rev": text_draft.revision,
"title": _normalize_title(text_draft.get_title()),
"title": title,
"authors": authors,
"abstract": text_draft.get_abstract(),
"document_date": text_draft.get_creation_date(),
Expand Down Expand Up @@ -1288,6 +1284,9 @@ def process_and_validate_submission(submission):
submission.title = text_metadata["title"]
submission.authors = text_metadata["authors"]

if not submission.title:
raise SubmissionError("Could not determine the title of the draft")

# Items always to get from text, even when XML is available
submission.abstract = text_metadata["abstract"]
submission.document_date = text_metadata["document_date"]
Expand Down

0 comments on commit bf3229b

Please sign in to comment.