-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add custom URL support for OAuth redirect #129
base: master
Are you sure you want to change the base?
Add custom URL support for OAuth redirect #129
Conversation
if '://' not in url: | ||
url = 'http://' + url | ||
url_scheme = url.split('://')[0].lower() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attaching http://
to the URL just prior to splitting at ://
will give you 'http'
. Isn't there a more elegant way to do this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Like I have done this in case no '://'(delimiter) and scheme is provided otherwise the custom URL is still validated with any scheme, (with http, https, ftp and ftps) as it happens in URL Validator.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we validate the URLs without mentioning any protocol? Or should we consider writing a custom URL validator all by scratch as suggested by @algomaster99 this is more of a hack?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have made the changes for validating the url without scheme.
|
||
redirect_urls = value.split(' ') | ||
for url in redirect_urls: | ||
validator(url) | ||
if '://' not in url: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we still have to do this? Doesn't the RegEx you wrote check for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, I wrote the custom regex for validating the URLs without any scheme, rest it is able to validate with any scheme we provide using URLValidator.
Referring to the issue:- #103