-
Notifications
You must be signed in to change notification settings - Fork 45
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
Allow opening deeplinks with custom schema #225
Conversation
Before this change opening URLs with a schema different from http/https wasn't possible because the code always prepended http. With this change http is only prepended when no schema is present.
startActivity(Intent.createChooser(url, caption)); | ||
|
||
String urlForIntentData = qrurl; | ||
if (!qrurl.toLowerCase().contains("://")) { |
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.
This does not respect the RFC 3986 which specifies what a valid protocol-scheme looks like.
A regex to match that should be ^[a-zA-Z][a-zA-Z0-9+.-]*:.*$
, but this needs to be checked and tested.
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.
You're absolutely right. I've added the regex and it looked good to me while testing locally.
I hope my PR directly on master is correct at all.
Another question: In case there is no valid protocol scheme the app will automatically prepend "http://" as before. Should we change this to "https://" to make sure TLS is used in case the uri is reachable via http and https?
Edit: Sorry for creating this PR "half-cooked". Honestly I've read the contribute markdown afterwards. If I should close the PR and create a new according to the rules let me know.
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.
Thanks for improving on this! 😄
I'll take a look and test your changes myself in the next few days and will check if using https as default won't break any expected use case.
We'd appreciate if you'd rebase your changes onto development
and target development
for the PR.
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 think I'm a little stuck here. I think when forking the repo I've only forked the master branch. On my fork there is only this one. I don't think I can rebase like that but I'm possibly lacking github (or maybe git) experience.
If you don't have a hint for me I'd start again completely.
- Close PR
- Delete my fork
- Create the fork again with all branches
- Branch create a feature branch from development and do my change
- Create a new PR from my feature branch to your development branch
Correct?
Use regex to verify the url protocol scheme is according to RFC 3986. Of no valid scheme is available add a default scheme.
Any chance this change will be merged? Should I do any further adaptions? |
I'm sorry for taking this long. |
Before this change opening URLs with a schema different from http/https wasn't possible because the code always prepended http.
With this change http is only prepended when no schema is present.