Skip to content

fix(python): invalid URL creation when output_file_prefix didn't end w…#2159

Open
KunalSin9h wants to merge 3 commits intoreplicate:mainfrom
KunalSin9h:file-upload-url
Open

fix(python): invalid URL creation when output_file_prefix didn't end w…#2159
KunalSin9h wants to merge 3 commits intoreplicate:mainfrom
KunalSin9h:file-upload-url

Conversation

@KunalSin9h
Copy link

@KunalSin9h KunalSin9h commented Feb 18, 2025

…ith /

In file upload docs (https://cog.run/http/#file-uploads):

{
    "output_file_prefix": "https://example.com/upload"
}

But in code, we are appending the filename directly into it without / in between. Then this url is used to send PUT request.

url = output_file_prefix + os.path.basename(name)

What it caused is 404 not found, since url become like /uploadimage.png.

consiquences

To fix this, user output_file_prefix need / at the end of url all the time. Hence this will give error when user forgot this.

{
-    "output_file_prefix": "https://example.com/upload",
+   "output_file_prefix": "https://example.com/upload/"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant