Skip to content

Commit 93a17da

Browse files
authored
Add files via upload
1 parent 74eef4d commit 93a17da

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

pyarchivefile.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -941,6 +941,13 @@ def ListDir(dirpath, followlink=False, duplicates=False, include_regex=None, exc
941941
include_pattern = re.compile(include_regex) if include_regex else None
942942
exclude_pattern = re.compile(exclude_regex) if exclude_regex else None
943943
for mydirfile in dirpath:
944+
if re.match("^file://", mydirfile, re.IGNORECASE):
945+
# Normalize to file:/// if it's a local path (no host)
946+
if mydirfile.lower().startswith("file://") and not mydirfile.lower().startswith("file:///"):
947+
# insert the extra slash
948+
mydirfile = "file:///" + mydirfile[7:]
949+
dparsed = urlparse(mydirfile)
950+
mydirfile = url2pathname(dparsed.path)
944951
if not os.path.exists(mydirfile):
945952
return False
946953
mydirfile = NormalizeRelativePath(mydirfile)
@@ -1011,6 +1018,13 @@ def ListDirAdvanced(dirpath, followlink=False, duplicates=False, include_regex=N
10111018
include_pattern = re.compile(include_regex) if include_regex else None
10121019
exclude_pattern = re.compile(exclude_regex) if exclude_regex else None
10131020
for mydirfile in dirpath:
1021+
if re.match("^file://", mydirfile, re.IGNORECASE):
1022+
# Normalize to file:/// if it's a local path (no host)
1023+
if mydirfile.lower().startswith("file://") and not mydirfile.lower().startswith("file:///"):
1024+
# insert the extra slash
1025+
mydirfile = "file:///" + mydirfile[7:]
1026+
dparsed = urlparse(mydirfile)
1027+
mydirfile = url2pathname(dparsed.path)
10141028
if not os.path.exists(mydirfile):
10151029
return False
10161030
mydirfile = NormalizeRelativePath(mydirfile)

0 commit comments

Comments
 (0)