Skip to content

Commit ac6b664

Browse files
committed
Added normalization of draft title extracted from submitted XML.
- Legacy-Id: 17119
1 parent 0a9cea5 commit ac6b664

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

ietf/submit/forms.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
from ietf.submit.parsers.xml_parser import XMLParser
4949
from ietf.utils import log
5050
from ietf.utils.draft import Draft
51+
from ietf.utils.text import normalize_text
5152

5253
class SubmissionBaseUploadForm(forms.Form):
5354
xml = forms.FileField(label='.xml format', required=True)
@@ -204,6 +205,7 @@ def format_messages(where, e, log):
204205
self.title = self.xmlroot.findtext('front/title').strip()
205206
if type(self.title) is six.text_type:
206207
self.title = unidecode(self.title)
208+
self.title = normalize_text(self.title)
207209
self.abstract = (self.xmlroot.findtext('front/abstract') or '').strip()
208210
if type(self.abstract) is six.text_type:
209211
self.abstract = unidecode(self.abstract)

ietf/utils/text.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,4 @@ def unwrap(s):
195195
return s.replace('\n', ' ')
196196

197197
def normalize_text(s):
198-
return s.replace(r'\s+', ' ').strip()
198+
return re.sub(r'[\s\u2028\u2029\n\r]+', ' ', s).strip()

0 commit comments

Comments
 (0)