Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rochakjain361
Copy link

Referring to the issue:- #103

Comment on lines 142 to 144
if '://' not in url:
url = 'http://' + url
url_scheme = url.split('://')[0].lower()
Copy link
Member

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?

Copy link
Author

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.

Copy link
Member

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?

Copy link
Author

@rochakjain361 rochakjain361 Oct 5, 2020

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:
Copy link
Member

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?

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants