Skip to content

Commit 599a782

Browse files
author
Payton Staub
committed
Don't strip leading slash from file uri
1 parent cff17b9 commit 599a782

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/sagemaker/workflow/utilities.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def hash_file(path: str) -> str:
5252
BUF_SIZE = 65536 # read in 64KiB chunks
5353
md5 = hashlib.md5()
5454
if path.lower().startswith("file://"):
55-
path = unquote(urlparse(path).path.strip('/'))
55+
path = unquote(urlparse(path).path)
5656
with open(path, "rb") as f:
5757
while True:
5858
data = f.read(BUF_SIZE)

tests/unit/sagemaker/workflow/test_utilities.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ def test_hash_file():
2727
def test_hash_file_uri():
2828
with tempfile.NamedTemporaryFile() as tmp:
2929
tmp.write("hashme".encode())
30-
hash = hash_file(f"file://{tmp.name}")
30+
hash = hash_file(f"file:///{tmp.name}")
3131
assert hash == "d41d8cd98f00b204e9800998ecf8427e"

0 commit comments

Comments
 (0)