Skip to content

fix(hf): escape file paths in download urls - #1326

Open
vedant21-oss wants to merge 1 commit into
kitops-ml:mainfrom
vedant21-oss:fix/hf-escape-file-paths
Open

vedant21-oss wants to merge 1 commit into
kitops-ml:mainfrom
vedant21-oss:fix/hf-escape-file-paths

Conversation

@vedant21-oss

Copy link
Copy Markdown
Contributor

Description

hugging face file paths were put into the download url without escaping, so file names with #, ? or % requested the wrong file or failed to parse.

this escapes each element of the path with url.PathEscape before building the url. normal names (including spaces and nested folders) end up with the same url as before.

added a test that builds the request url for a few file names and checks the path comes back unchanged with no query or fragment. the #, ? and % cases fail on main.

the test is in a new download_url_test.go since #1223 adds download_test.go, to avoid a conflict there.

Linked issues

fixes #1325

Hugging Face file paths were put into the download URL as is, so file
names with '#', '?' or '%' requested the wrong file or failed to parse.
Escape each path element with url.PathEscape before building the URL.

Fixes kitops-ml#1325

Signed-off-by: vedant21-oss <vedantmalodeofficial@gmail.com>

This branch has not been deployed

No deployments
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.

kit import doesn't url escape hugging face file paths

1 participant