-
Notifications
You must be signed in to change notification settings - Fork 613
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] Fix 404 NOT FOUND issue caused by endpoint tail slash #2721
[BUG] Fix 404 NOT FOUND issue caused by endpoint tail slash #2721
Conversation
Signed-off-by: Mingqi Hu <mingqi.hu@intel.com>
@Wauplin could you please review this PR? thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @Mingqi2, one of the maintainers of huggingface_hub
here 👋
thanks a lot for your contribution! indeed, some servers might block double slashes in URLs as they can potentially lead to security vulnerabilities (see this stackoverflow comment for more context). This is not the case for https://huggingface.co but since we also allow custom endpoints, we can handle this case properly with a minimal endpoint normalization!
Co-authored-by: Célina <hanouticelina@gmail.com>
Co-authored-by: Célina <hanouticelina@gmail.com>
Co-authored-by: Célina <hanouticelina@gmail.com>
@hanouticelina thanks for your warm reply! I have commited most of your changes. Please take a look again and help to merge it thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just noticed a typo in the imports, once it's fixed, we will be good to merge! 🎉
Co-authored-by: Célina <hanouticelina@gmail.com>
Good catch. It's committed thanks! Let's merge 🎉 |
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The issue was triggered when user added a tail slash '/' in
HF_ENDPOINT
, like$set HF_ENDPOINT=https://hf-mirror.com/
.Then it's interesting (stupid?) to visit a link like - https://hf-mirror.com//api/models/sentence-transformers/all-MiniLM-L6-v2/revision/main by huggingface.
Okay then you got 404 and don't know why. Bad experience and you should take care of them in the code with urljoin and carefully strip.