Skip to content

Commit 5a9967b

Browse files
authored
Add files via upload
1 parent 5a84693 commit 5a9967b

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

pyfoxfile.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,11 @@ def RemoveWindowsPath(dpath):
868868
"""
869869
if not dpath:
870870
return ""
871-
if(re.findall("^file:/{2,3}", dpath)):
871+
if re.match("^file://", dpath, re.IGNORECASE):
872+
# Normalize to file:/// if it's a local path (no host)
873+
if dpath.lower().startswith("file://") and not dpath.lower().startswith("file:///"):
874+
# insert the extra slash
875+
dpath = "file:///" + dpath[7:]
872876
dparsed = urlparse(dpath)
873877
dpath = url2pathname(dparsed.path)
874878
# Accept bytes and decode safely
@@ -886,7 +890,11 @@ def NormalizeRelativePath(inpath):
886890
"""
887891
Ensures the path is relative unless it is absolute. Prepares consistent relative paths.
888892
"""
889-
if(re.findall("^file:/{2,3}", inpath)):
893+
if re.match("^file://", inpath, re.IGNORECASE):
894+
# Normalize to file:/// if it's a local path (no host)
895+
if inpath.lower().startswith("file://") and not inpath.lower().startswith("file:///"):
896+
# insert the extra slash
897+
inpath = "file:///" + inpath[7:]
890898
dparsed = urlparse(inpath)
891899
inpath = url2pathname(dparsed.path)
892900
inpath = RemoveWindowsPath(inpath)

0 commit comments

Comments
 (0)