Updated utils/common.py

Fixed bug with regex to allow for pathspecs containing a period (.)
character, and amended statement to flake8 W504 definition.
This commit is contained in:
Ethan Smith-Coss 2022-05-12 14:01:06 +01:00
parent e4446c90ec
commit 61c3411faf
Signed by: TheOnePath
GPG Key ID: 4E7D436CE1A0BAF1

View File

@ -48,6 +48,5 @@ def is_path_spec(path_spec: str) -> bool:
"""
## perform a regex match to ensure that the given path is a
## valid pathspec for the system.
return bool(re.match(
__REGEX_PAT, path_spec.strip(r"\"'")) or re.match(r'^[\w\d\-_]+$', path_spec.strip(r"\"'"))
)
return bool(re.match(__REGEX_PAT, path_spec.strip(r"\"'"))
or re.match(r'^[\w\d\-_\.]+$', path_spec.strip(r"\"'")))