Update PDF.js version extraction for 5.3.31
It's changed in this PR: https://github.com/mozilla/pdf.js/pull/19956 to have the version string as a comment in the file, instead of the variable. Making the regex more forgiving increases the chance of matching on the wrong string on a past or future version. I've only tested with the previous version (v5.2.133) and it seemed to still work there. Changes I made to the regex: * add the literal * to the match group of possible prefixes of pdfjsVersion * make the quotes around the version optional * make the semicolon at the end of the line optional * add newline to the list of characters that can terminate the match group (otherwise it was matching across the end of the line up to the first string, kinda odd when there was a $ after the match group)
This commit is contained in:
parent
060f4a59d6
commit
422680046e
|
|
@ -487,7 +487,7 @@ def _pdfjs_version() -> str:
|
|||
else:
|
||||
pdfjs_file = pdfjs_file.decode('utf-8')
|
||||
version_re = re.compile(
|
||||
r"""^ *(PDFJS\.version|(var|const) pdfjsVersion) = ['"](?P<version>[^'"]+)['"];$""",
|
||||
r"""^ *(PDFJS\.version|(var|const|\*) pdfjsVersion) = ['"]?(?P<version>[^'"\n]+)['"]?;?$""",
|
||||
re.MULTILINE)
|
||||
|
||||
match = version_re.search(pdfjs_file)
|
||||
|
|
|
|||
Loading…
Reference in New Issue