Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

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/"
}

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant