diff --git a/swh/loader/package/golang/loader.py b/swh/loader/package/golang/loader.py index bbcd37a3f0c70cccad2f434854bc4b1667a34b13..c1890da1f5416281aa49fb397f12f052053f8b21 100644 --- a/swh/loader/package/golang/loader.py +++ b/swh/loader/package/golang/loader.py @@ -82,7 +82,7 @@ class GolangLoader(PackageLoader[GolangPackageInfo]): filename = f"{encoded_name}-{version}.zip" timestamp = TimestampWithTimezone.from_iso8601(self._raw_info(version)["Time"]) p_info = GolangPackageInfo( - url=f"{self.url}/@v/{version}.zip", + url=f"{self.url}/@v/{_uppercase_encode(version)}.zip", filename=filename, version=version, timestamp=timestamp, diff --git a/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_list b/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_list index b18d46540b351fd16dbe1a25a76f32cbc678deea..298de5bf0d2c82c6484545189a95ac362e0eb89e 100644 --- a/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_list +++ b/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_list @@ -1 +1,2 @@ v1.0.1 +v1.0.1-RC1 diff --git a/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_v1.0.1-!r!c1.info b/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_v1.0.1-!r!c1.info new file mode 100644 index 0000000000000000000000000000000000000000..369f79432003d8e72655e90ad5edb2ca15347927 --- /dev/null +++ b/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_v1.0.1-!r!c1.info @@ -0,0 +1 @@ +{"Version":"v1.0.1-RC1","Time":"2022-02-23T18:02:43Z"} \ No newline at end of file diff --git a/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_v1.0.1-!r!c1.zip b/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_v1.0.1-!r!c1.zip new file mode 120000 index 0000000000000000000000000000000000000000..d8b9df2892611aa3471616b6bb58baeee768e2c0 --- /dev/null +++ b/swh/loader/package/golang/tests/data/https_proxy.golang.org/github.com_adam-hanna_array!operations_@v_v1.0.1-!r!c1.zip @@ -0,0 +1 @@ +github.com_adam-hanna_array!operations_@v_v1.0.1.zip \ No newline at end of file diff --git a/swh/loader/package/golang/tests/test_golang.py b/swh/loader/package/golang/tests/test_golang.py index 5888d9b2775ac2095dc4c31116c3c2136cb481d4..e19864a9013644501fda4d92e5b212b1117ccfd2 100644 --- a/swh/loader/package/golang/tests/test_golang.py +++ b/swh/loader/package/golang/tests/test_golang.py @@ -13,13 +13,18 @@ def test_golang_loader_first_visit(swh_storage, requests_mock_datadir): assert loader.load()["status"] == "eventful" -def test_golang_loader_package_name_with_uppercase_characters( +def test_golang_loader_package_or_version_name_with_uppercase_characters( swh_storage, requests_mock_datadir ): url = "https://pkg.go.dev/github.com/adam-hanna/arrayOperations" loader = GolangLoader(swh_storage, url) assert loader.load()["status"] == "eventful" + assert set(loader.last_snapshot().branches) == { + b"releases/v1.0.1", + b"releases/v1.0.1-RC1", + b"HEAD", + } def test_golang_loader_package_with_dev_version_only(