fixed choking on 'Author: [PTAdmin]'-lines

Sun, 23 Jun 2019 00:55:21 +0300

author
Teemu Piippo <teemu@hecknology.net>
date
Sun, 23 Jun 2019 00:55:21 +0300
changeset 76
c73432653fd9
parent 75
3ec747dfbfb9
child 77
d98502ae1f33

fixed choking on 'Author: [PTAdmin]'-lines

header.py file | annotate | diff | comparison | revisions
--- a/header.py	Sun Jun 23 00:50:22 2019 +0300
+++ b/header.py	Sun Jun 23 00:55:21 2019 +0300
@@ -104,7 +104,9 @@
         self.skip_to_next()
         result.name = self.parse_pattern(r'^Name: (.+)$', 'name')[0]
         self.skip_to_next()
-        result.author, result.username = self.parse_pattern(r'^Author: ([^ \[]*[^\[]+) (?:\[([^\]]+)\])?', 'author')
+        result.author, result.username = self.parse_pattern(r'^Author: (?:([^ \[]*[^\[]+) )?(?:\[([^\]]+)\])?', 'author')
+        if not result.author and not result.username:
+            self.parse_error('author line does not contain a name nor username')
         for header_entry in self.get_more_header_stuff():
             if self.try_to_match(
                 r'^!LDRAW_ORG ' \

mercurial