huggingface_hub
d04c3b20 - [URIs] Parse web URLs in `parse_hf_uri` + add `HfUri.to_url` (#4296)

Commit
6 hours ago
[URIs] Parse web URLs in `parse_hf_uri` + add `HfUri.to_url` (#4296) * [URIs] Support parsing web URLs in parse_hf_uri + add HfUri.to_url Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * Apply suggestion from @Wauplin * [URIs] Move recognized URL hosts to constants.HF_URL_HOSTS Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * [URIs] URL-decode path, encode in to_url, drop media route, render buckets as /tree - Percent-decode path segments when parsing web URLs so file names with spaces, '#', ... resolve correctly (revision was already decoded, path was not). - to_url() now percent-encodes the path (inverse of parsing), keeping '/' as separator. - Remove 'media' from recognized URL routes (not a Hub location we want to parse). - to_url() renders bucket files via the '/tree/<path>' route instead of '/resolve/<path>'. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * update tables * improve test readability * Update src/huggingface_hub/utils/_hf_uris.py Co-authored-by: célina <hanouticelina@gmail.com> * nit --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: célina <hanouticelina@gmail.com>
Author
Parents
Loading