Repository: ietf-tools/datatracker

Issue:
Draft submission fails validation if title is split across lines at a hyphen in text format
### Describe the issue

I try to upload this draft, which has worked in the past. Now, I get a confusing screen that, if I read to the bottom, indicates that the draft was rejected because the title is too long. The error reads:
```
Submission rejected: Text Internet-Draft title (Unilateral Opportunistic Deployment of Encrypted Recursive-to- Authoritative DNS) disagrees with XML Internet-Draft title (Unilateral Opportunistic Deployment of Encrypted Recursive-to-Authoritative DNS)
```

GitHub is not allowing me to attach the XML file that causes this error. The relevant bit is:
```
<rfc ipr="trust200902" docName="draft-ietf-dprive-unilateral-probing-06" category="std" consensus="true" submissionType="IETF">
  <front>
    <title abbrev="Unilateral Encrypted Authoritative DNS">Unilateral Opportunistic Deployment of Encrypted Recursive-to-Authoritative DNS</title>
 ```

### Code of Conduct

- [X] I agree to follow the [IETF's Code of Conduct](https://github.com/ietf-tools/.github/blob/main/CODE_OF_CONDUCT.md)


Discussion:
The problem is not that the title is too long, it's that it is split across lines in the text rendering at a hyphen. The lines are then incorrectly joined with a space, causing the validator to believe that the text version has a different title than the XML version.

This check may have been ignored by the old submission validations when we generated our own text from an XML-only upload, but the code path is now shared between that case and the case when a user uploads both XML and their own text.

We can fix this by skipping the check when we generated our own text and/or by properly joining multiline titles when lines end in hyphens. Probably the latter is preferable because it avoids hiding a bug in the text file parsing.
"Skipping the check" is probably more reliable. There are reasons that a line might end in a hyphen that is not a hyphenated word, as as at the "Pre-" in  "An Examination of the Obscure Security Properties of Pre- and Post-Colonial Protocols"
That's true - I don't think we're going to get a perfect parser going. For now, I think the more common case is the one that caused the failure here so it is better to get that right. I'll create a ticket to improve the handling of title validation.

I will also create one to improve the UI experience on the status page when the validation of a draft fails. It's definitely confusing (or worse) now.
Thanks! Yeah, I had to read the page twice before I could figure out why it said that the XML I submitted had no title and was zero length.

Resolving patch:
diff --git a/ietf/submit/utils.py b/ietf/submit/utils.py
--- a/ietf/submit/utils.py
+++ b/ietf/submit/utils.py
@@ -1265,7 +1265,11 @@ def process_and_validate_submission(submission):
         # Parse text, whether uploaded or generated from XML
         text_metadata = process_submission_text(submission.name, submission.rev)
 
-        if xml_metadata and xml_metadata["title"] != text_metadata["title"]:
+        if (
+            ".txt" in submission.file_types
+            and xml_metadata
+            and xml_metadata["title"] != text_metadata["title"]
+        ):
             raise SubmissionError(
                 f"Text Internet-Draft title ({text_metadata['title']}) "
                 f"disagrees with XML Internet-Draft title ({xml_metadata['title']})"
@@ -1275,13 +1279,14 @@ 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.authors = xml_metadata["authors"]
         else:
             # Items to get from text only if XML not available
+            submission.title = text_metadata["title"]
             submission.authors = text_metadata["authors"]
 
         # Items always to get from text, even when XML is available
-        submission.title = text_metadata["title"]  # verified above this agrees with XML, if present
         submission.abstract = text_metadata["abstract"]
         submission.document_date = text_metadata["document_date"]
         submission.pages = text_metadata["pages"]


Test patch: