Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion ovh/consumer_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ def add_recursive_rules(self, methods, path):

>>> ck.add_recursive_rules(["GET", "POST", "PUT", "DELETE"], "/sms")
"""
path = path.rstrip("*/ ")
# trim one explicit "/*" or "/" tail, nothing more. rstrip("*/ ") ate
# any run of those characters and could quietly widen what was granted.
path = path.strip()
if path.endswith("/*"):
path = path[:-2]
path = path.rstrip("/")
if path:
self.add_rules(methods, path)
self.add_rules(methods, path + "/*")