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

Allow opening deeplinks with custom schema #225

Merged
merged 2 commits into from
Jul 8, 2024

Conversation

jokakilla
Copy link

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.

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.
@jokakilla jokakilla mentioned this pull request Mar 10, 2024
@udenr udenr requested a review from coderPaddyS March 22, 2024 17:42
startActivity(Intent.createChooser(url, caption));

String urlForIntentData = qrurl;
if (!qrurl.toLowerCase().contains("://")) {
Copy link
Contributor

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.

Copy link
Author

@jokakilla jokakilla Apr 22, 2024

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.

Copy link
Contributor

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.

Copy link
Author

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.
@jokakilla
Copy link
Author

Any chance this change will be merged? Should I do any further adaptions?

@coderPaddyS coderPaddyS changed the base branch from master to development July 8, 2024 06:03
@coderPaddyS
Copy link
Contributor

coderPaddyS commented Jul 8, 2024

I'm sorry for taking this long.
If looked into branch and noticed that a rebase is not necessary as no merge conflicts happen.
Thank you for your contribution, it will be merged into the master-branch by the next release. :D

@coderPaddyS coderPaddyS merged commit 7865cd9 into SecUSo:development Jul 8, 2024
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.

2 participants