Skip to content

Commit 2653573

Browse files
committed
fix: escape more invalid repo string characters
Fixes #2799
1 parent c981569 commit 2653573

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

python/private/pypi/whl_repo_name.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def whl_repo_name(filename, sha256):
4444
else:
4545
parsed = parse_whl_name(filename)
4646
name = normalize_name(parsed.distribution)
47-
version = parsed.version.replace(".", "_").replace("!", "_")
47+
version = parsed.version.replace(".", "_").replace("!", "_").replace("+", "_").replace("%", "_")
4848
python_tag, _, _ = parsed.python_tag.partition(".")
4949
abi_tag, _, _ = parsed.abi_tag.partition(".")
5050
platform_tag, _, _ = parsed.platform_tag.partition(".")

tests/pypi/whl_repo_name/whl_repo_name_tests.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,18 @@ def _test_platform_whl(env):
5454

5555
_tests.append(_test_platform_whl)
5656

57+
def _test_name_with_plus(env):
58+
got = whl_repo_name("gptqmodel-2.0.0+cu126torch2.6-cp312-cp312-linux_x86_64.whl", "")
59+
env.expect.that_str(got).equals("gptqmodel_2_0_0_cu126torch2_6_cp312_cp312_linux_x86_64")
60+
61+
_tests.append(_test_name_with_plus)
62+
63+
def _test_name_with_percent(env):
64+
got = whl_repo_name("gptqmodel-2.0.0%2Bcu126torch2.6-cp312-cp312-linux_x86_64.whl", "")
65+
env.expect.that_str(got).equals("gptqmodel_2_0_0_2Bcu126torch2_6_cp312_cp312_linux_x86_64")
66+
67+
_tests.append(_test_name_with_percent)
68+
5769
def whl_repo_name_test_suite(name):
5870
"""Create the test suite.
5971

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy