Skip to content

Commit

Permalink
Restrict rootless path assignment if authority is present.
Browse files Browse the repository at this point in the history
  • Loading branch information
amcgregor committed Oct 31, 2018
1 parent b5855ca commit 84e0787
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions uri/part/path.py
Expand Up @@ -26,6 +26,9 @@ def __set__(self, obj, value):
value = str(value)
obj._trailing = value.endswith('/')

if obj.authority and not value.startswith('/'):
raise ValueError("Can only assign rooted paths to URI with authority.")

super(PathPart, self).__set__(obj, value)

def render(self, obj, value):
Expand Down

0 comments on commit 84e0787

Please sign in to comment.