Skip to content

Commit

Permalink
adding / should only happen if netloc
Browse files Browse the repository at this point in the history
  • Loading branch information
bdraco committed Oct 25, 2024
1 parent bf918db commit 3885557
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions yarl/_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,7 @@ def calculate_relative_path(target: str, base: str) -> str:
target_path_parts: Union[set[str], None] = None
target_path_path = target_path.path

target_path_is_absolute = target[0] == "/" if target else True
base_path_is_absolute = base[0] == "/" if base else True
if target_path_is_absolute != base_path_is_absolute:
if (target and target[0] == "/") != (base and base[0] == "/"):
raise ValueError(
f"{target_path_path!r} and {base_path.path!r} have different anchors"
)
Expand Down

0 comments on commit 3885557

Please sign in to comment.