@@ -953,6 +953,13 @@ def ListDir(dirpath, followlink=False, duplicates=False, include_regex=None, exc
953953 include_pattern = re .compile (include_regex ) if include_regex else None
954954 exclude_pattern = re .compile (exclude_regex ) if exclude_regex else None
955955 for mydirfile in dirpath :
956+ if re .match ("^file://" , mydirfile , re .IGNORECASE ):
957+ # Normalize to file:/// if it's a local path (no host)
958+ if mydirfile .lower ().startswith ("file://" ) and not mydirfile .lower ().startswith ("file:///" ):
959+ # insert the extra slash
960+ mydirfile = "file:///" + mydirfile [7 :]
961+ dparsed = urlparse (mydirfile )
962+ mydirfile = url2pathname (dparsed .path )
956963 if not os .path .exists (mydirfile ):
957964 return False
958965 mydirfile = NormalizeRelativePath (mydirfile )
@@ -1023,6 +1030,13 @@ def ListDirAdvanced(dirpath, followlink=False, duplicates=False, include_regex=N
10231030 include_pattern = re .compile (include_regex ) if include_regex else None
10241031 exclude_pattern = re .compile (exclude_regex ) if exclude_regex else None
10251032 for mydirfile in dirpath :
1033+ if re .match ("^file://" , mydirfile , re .IGNORECASE ):
1034+ # Normalize to file:/// if it's a local path (no host)
1035+ if mydirfile .lower ().startswith ("file://" ) and not mydirfile .lower ().startswith ("file:///" ):
1036+ # insert the extra slash
1037+ mydirfile = "file:///" + mydirfile [7 :]
1038+ dparsed = urlparse (mydirfile )
1039+ mydirfile = url2pathname (dparsed .path )
10261040 if not os .path .exists (mydirfile ):
10271041 return False
10281042 mydirfile = NormalizeRelativePath (mydirfile )
0 commit comments