Commit 6b4c7b8e093fc10a6223fb4ca694fa0dde07ea6d

Authored by Michal Ambroz
Committed by GitHub
1 parent 78b2d459

oleobj.py syntax error

In python 3.12+ this escaping is reported as syntax error. Moving the dash to the end of the regex avoids the need for escaping it.

oletools/oleobj.py:537
  /rpmbuild/BUILD/oletools-78b2d459a33df378a4f69ffc6c33313509cecfe4/oletools/oleobj.py:537: SyntaxWarning: invalid escape sequence '\-'
    sane_fname = re.sub(u'[^a-zA-Z0-9.\-_ ]', replacement, basepath)
Showing 1 changed file with 1 additions and 1 deletions
oletools/oleobj.py
@@ -534,7 +534,7 @@ def sanitize_filename(filename, replacement='_', @@ -534,7 +534,7 @@ def sanitize_filename(filename, replacement='_',
534 Might return empty string 534 Might return empty string
535 """ 535 """
536 basepath = os.path.basename(filename).strip() 536 basepath = os.path.basename(filename).strip()
537 - sane_fname = re.sub(u'[^a-zA-Z0-9.\-_ ]', replacement, basepath) 537 + sane_fname = re.sub(u'[^a-zA-Z0-9._ -]', replacement, basepath)
538 sane_fname = str(sane_fname) # py3: does nothing; py2: unicode --> str 538 sane_fname = str(sane_fname) # py3: does nothing; py2: unicode --> str
539 539
540 while ".." in sane_fname: 540 while ".." in sane_fname: