Make PathFilter's filter tolerant to empty strings

Signed-off-by: JoeLametta <JoeLametta@users.noreply.github.com>
This commit is contained in:
JoeLametta
2021-05-14 10:31:53 +00:00
parent 84e4ef6ab8
commit 1e33bc62ed

View File

@@ -44,7 +44,7 @@ class PathFilter:
def filter(self, path):
R_CH = '_'
if self._dot:
if path[0] == '.':
if path[:1] == '.': # Slicing tolerant to empty strings
path = R_CH + path[1:]
if self._posix:
path = re.sub(r'[\/\x00]', R_CH, path)