mastodon login: also strip trailing path

This commit is contained in:
codl 2017-09-08 00:41:45 +02:00
parent d7e1a7f179
commit 43903a5776
No known key found for this signature in database
GPG Key ID: 6CD7C8891ED1233A
1 changed files with 7 additions and 2 deletions

View File

@ -276,9 +276,14 @@ def mastodon_login_step1(instance=None):
generic_error='error' in request.args generic_error='error' in request.args
) )
instance_url = instance_url.lower()
# strip protocol
instance_url = re.sub('^https?://', '', instance_url, instance_url = re.sub('^https?://', '', instance_url,
count=1, flags=re.IGNORECASE) count=1, flags=re.IGNORECASE)
instance_url = instance_url.split("@")[-1].lower() # strip username
instance_url = instance_url.split("@")[-1]
# strip trailing path
instance_url = instance_url.split('/')[0]
callback = url_for('mastodon_login_step2', callback = url_for('mastodon_login_step2',
instance_url=instance_url, _external=True) instance_url=instance_url, _external=True)