mirror of
https://github.com/wassname/flask-security.git
synced 2026-08-12 12:00:37 +08:00
Merge pull request #347 from Jaza/slash-url-suffix
re #343: Add slash before or after token in flask-security URLs correctly
This commit is contained in:
@@ -188,6 +188,14 @@ def get_url(endpoint_or_url):
|
||||
return endpoint_or_url
|
||||
|
||||
|
||||
def slash_url_suffix(url, suffix):
|
||||
"""Adds a slash either to the beginning or the end of a suffix
|
||||
(which is to be appended to a URL), depending on whether or not
|
||||
the URL ends with a slash."""
|
||||
|
||||
return url.endswith('/') and ('%s/' % suffix) or ('/%s' % suffix)
|
||||
|
||||
|
||||
def get_security_endpoint_name(endpoint):
|
||||
return '%s.%s' % (_security.blueprint_name, endpoint)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user