From bcb62109a89dc35e610442275db63889e0535bc3 Mon Sep 17 00:00:00 2001 From: Kunal Singh Date: Tue, 18 Feb 2025 14:39:53 +0530 Subject: [PATCH] fix(python): invalid url cration when output_file_prefix didn't end with / --- python/cog/files.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cog/files.py b/python/cog/files.py index ce0bd47152..7303fb9c7e 100644 --- a/python/cog/files.py +++ b/python/cog/files.py @@ -14,7 +14,7 @@ def upload_file(fh: io.IOBase, output_file_prefix: Optional[str] = None) -> str: if output_file_prefix is not None: name = getattr(fh, "name", "output") - url = output_file_prefix + os.path.basename(name) + url = output_file_prefix.rstrip("/") + "/" + os.path.basename(name) resp = requests.put(url, files={"file": fh}, timeout=5) resp.raise_for_status() return url