mirror of
https://github.com/YunoHost/yunohost.git
synced 2024-09-03 20:06:10 +02:00
Merge pull request #368 from YunoHost/change_url_double_slash
'/' was resulting in '//' in change_url
This commit is contained in:
commit
1aa34b76e4
1 changed files with 10 additions and 2 deletions
|
@ -445,8 +445,9 @@ def app_change_url(auth, app, domain, path):
|
|||
|
||||
# Normalize path and domain format
|
||||
domain = domain.strip().lower()
|
||||
old_path = '/' + old_path.strip("/").strip() + '/'
|
||||
path = '/' + path.strip("/").strip() + '/'
|
||||
|
||||
old_path = normalize_url_path(old_path)
|
||||
path = normalize_url_path(path)
|
||||
|
||||
if (domain, path) == (old_domain, old_path):
|
||||
raise MoulinetteError(errno.EINVAL, m18n.n("app_change_url_identical_domains", domain=domain, path=path))
|
||||
|
@ -2105,3 +2106,10 @@ def random_password(length=8):
|
|||
|
||||
char_set = string.ascii_uppercase + string.digits + string.ascii_lowercase
|
||||
return ''.join([random.SystemRandom().choice(char_set) for x in range(length)])
|
||||
|
||||
|
||||
def normalize_url_path(url_path):
|
||||
if url_path.strip("/").strip():
|
||||
return '/' + url_path.strip("/").strip() + '/'
|
||||
|
||||
return "/"
|
||||
|
|
Loading…
Add table
Reference in a new issue