From 422680046e45679551ceb0d08804ad4b008a284a Mon Sep 17 00:00:00 2001 From: toofar Date: Mon, 2 Jun 2025 20:32:09 +1200 Subject: [PATCH] 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) --- qutebrowser/utils/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qutebrowser/utils/version.py b/qutebrowser/utils/version.py index e9cea7866..37bfe0dc4 100644 --- a/qutebrowser/utils/version.py +++ b/qutebrowser/utils/version.py @@ -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[^'"]+)['"];$""", + r"""^ *(PDFJS\.version|(var|const|\*) pdfjsVersion) = ['"]?(?P[^'"\n]+)['"]?;?$""", re.MULTILINE) match = version_re.search(pdfjs_file)