From c51ac6f9684c57ded40334ed63348305780fb89d Mon Sep 17 00:00:00 2001 From: Mo Hyun Date: Wed, 23 Oct 2024 08:53:14 -0700 Subject: [PATCH] Fix special case of blank path and pattern --- dotdrop/utils.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/dotdrop/utils.py b/dotdrop/utils.py index e93fc8f1..b34d4e9e 100644 --- a/dotdrop/utils.py +++ b/dotdrop/utils.py @@ -17,9 +17,9 @@ import shutil import json import sys +from pathlib import PurePath import requests from packaging import version -from pathlib import PurePath # local import from dotdrop.logger import Logger @@ -232,7 +232,11 @@ def _match_ignore_pattern(path, pattern, debug=False): be able to match pattern like "*/dir" """ subpath = path - while subpath != PurePath(path).anchor: + + # Account for Windows paths + drive = PurePath(path).drive + + while subpath.lstrip(drive) != os.path.sep: # if debug: # msg = f'fnmatch \"{subpath}\" against {pattern}' # LOG.dbg(msg, force=True)