Skip to content

Commit

Permalink
fix: Avoid validation crash when title parsing fails (#7131)
Browse files Browse the repository at this point in the history
* fix: Add guards after failed submission validation

* fix: Avoid nulling submission.title
  • Loading branch information
jennifer-richards authored Mar 5, 2024
1 parent 93fca00 commit 3afd6ca
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ietf/submit/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1280,11 +1280,11 @@ def process_and_validate_submission(submission):
if xml_metadata is not None:
# Items preferred / only available from XML
submission.xml_version = xml_metadata["xml_version"]
submission.title = xml_metadata["title"]
submission.title = xml_metadata["title"] or ""
submission.authors = xml_metadata["authors"]
else:
# Items to get from text only if XML not available
submission.title = text_metadata["title"]
submission.title = text_metadata["title"] or ""
submission.authors = text_metadata["authors"]

if not submission.title:
Expand Down Expand Up @@ -1371,6 +1371,7 @@ def process_and_accept_uploaded_submission(submission):
try:
process_and_validate_submission(submission)
except SubmissionError as err:
submission.refresh_from_db() # guard against incomplete changes in submission validation / processing
cancel_submission(submission) # changes Submission.state
create_submission_event(None, submission, f"Submission rejected: {err}")
return
Expand Down Expand Up @@ -1410,11 +1411,13 @@ def process_uploaded_submission(submission):
try:
process_and_validate_submission(submission)
except InconsistentRevisionError as consistency_error:
submission.refresh_from_db() # guard against incomplete changes in submission validation / processing
submission.state_id = "manual"
submission.save()
create_submission_event(None, submission, desc="Uploaded submission (diverted to manual process)")
send_manual_post_request(None, submission, errors=dict(consistency=str(consistency_error)))
except SubmissionError as err:
submission.refresh_from_db() # guard against incomplete changes in submission validation / processing
cancel_submission(submission) # changes Submission.state
create_submission_event(None, submission, f"Submission rejected: {err}")
else:
Expand Down

0 comments on commit 3afd6ca

Please sign in to comment.