Skip to content

Commit

Permalink
Remove unreachable authority absolute path check in URL.__new__ (#1368
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bdraco authored Oct 21, 2024
1 parent 2911088 commit ea970f2
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions yarl/_url.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,6 @@ def rewrite_module(obj: _T) -> _T:
return obj


def _raise_for_authority_missing_abs_path() -> None:
"""Raise when he path in URL with authority starts lacks a leading slash."""
msg = "Path in a URL with authority should start with a slash ('/') if set"
raise ValueError(msg)


@rewrite_module
class URL:
# Don't derive from str
Expand Down Expand Up @@ -270,8 +264,6 @@ def __new__(
if netloc:
if "." in path:
path = normalize_path(path)
if path[0] != "/":
_raise_for_authority_missing_abs_path()

query = QUERY_REQUOTER(query) if query else query
fragment = FRAGMENT_REQUOTER(fragment) if fragment else fragment
Expand Down Expand Up @@ -376,7 +368,11 @@ def build(
if "." in path:
path = normalize_path(path)
if path[0] != "/":
_raise_for_authority_missing_abs_path()
msg = (
"Path in a URL with authority should "
"start with a slash ('/') if set"
)
raise ValueError(msg)

query_string = QUERY_QUOTER(query_string) if query_string else query_string
fragment = FRAGMENT_QUOTER(fragment) if fragment else fragment
Expand Down

0 comments on commit ea970f2

Please sign in to comment.