From 0974deffd5c5cf25d312cefbfefe85a4ffd2ccf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Date: Thu, 4 Jul 2024 05:46:33 +0200 Subject: [PATCH] cargo: Handle trailing slash in GitHub URLs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michał Górny --- pycargoebuild/cargo.py | 2 +- test/test_cargo.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pycargoebuild/cargo.py b/pycargoebuild/cargo.py index 0c904c4..65a5006 100644 --- a/pycargoebuild/cargo.py +++ b/pycargoebuild/cargo.py @@ -192,7 +192,7 @@ def get_crates(f: typing.BinaryIO) -> typing.Generator[Crate, None, None]: raise RuntimeError( "Git crate with no fragment identifier (i.e. commit " f"identifier): {p['source']!r}") - repo = parsed_url.path.lstrip("/") + repo = parsed_url.path.strip("/") if repo.endswith(".git"): repo = repo[:-4] if repo.count("/") != 1: diff --git a/test/test_cargo.py b/test/test_cargo.py index 0bff67a..88a58b6 100644 --- a/test/test_cargo.py +++ b/test/test_cargo.py @@ -56,7 +56,7 @@ [[package]] name = "regex-syntax" version = "0.6.28" - source = """git+https://github.com/01mf02/regex?rev=90eebbd\\ + source = """git+https://github.com/01mf02/regex.git/?rev=90eebbd\\ #90eebbdb9396ca10510130327073a3d596674d04""" '''