fix: encode package name in URL for source files

Package(Base) names might include characters that require url-encoding

Signed-off-by: moson-mo <mo-son@mailbox.org>
This commit is contained in:
moson-mo 2023-03-01 18:04:20 +01:00
parent 8aac842307
commit 7d06c9ab97
No known key found for this signature in database
GPG key ID: 4A4760AB4EE15296
2 changed files with 8 additions and 1 deletions

View file

@ -109,6 +109,12 @@ def test_source_uri_file(package: Package):
expected = source_file_uri % (pkgsrc.Source, package.PackageBase.Name)
assert (file, uri) == (FILE, expected)
# test URL encoding
pkgsrc.Package.PackageBase.Name = "test++"
file, uri = util.source_uri(pkgsrc)
expected = source_file_uri % (pkgsrc.Source, "test%2B%2B")
assert uri == expected
def test_source_uri_named_uri(package: Package):
FILE = "test"