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 additional uris to FileReceiverActivity.java #3936

Closed
wants to merge 1 commit into from

Conversation

macearl
Copy link

@macearl macearl commented Apr 30, 2024

Added

  • gopher
  • irc
  • irc6
  • ircs
  • jabber
  • mailto
  • nfs
  • nzblnk
  • rtmp
  • sftp
  • smb

Uris

Fixes: #3935

Added
- gopher
- irc
- irc6
- ircs
- jabber
- mailto
- nfs
- nzblnk
- rtmp
- sftp
- smb

Uris
@agnostic-apollo
Copy link
Member

There a lot of other protocols that are supported by https://github.com/chedim/termux-launcher/blob/17fc6b66e55b4fb53c58a439ad35cc2aa410d0e8/termux-shared/src/main/java/com/termux/shared/termux/data/TermuxUrlUtils.java for terminal url extractor that also need to be supported. Just adding the above ones is not enough and regexes used are not compliant with rfc approved characters/formats, like Pattern.WEB_URL handles them.

I have locally ported the Pattern class regexes and combined the protocols in TermuxUrlUtils and fixed the regexes so both termux-url-opener and terminal url extractor have consistent experience. Changes should be available in next pre release when I push changes. There are conflicts as FileReceiverActivity class does not exist anymore in my local changes and has been rewritten, so cannot push to master currently.

@agnostic-apollo
Copy link
Member

Thanks for the report and attempt though.

@macearl
Copy link
Author

macearl commented May 1, 2024

Thanks, I was not aware of the changes in your fork.
I have 2 additional questions however (if that's alright):

  • Am I correct in assuming these changes will eventually be merged into the upstream termux/termux-app project or will they only be done in the forked project?
  • if I'm reading the code right and the old class got removed entirely this removes the support for magnet links right? I think they should still be supported, the format is also a bit different and probably doesn't fit that neatly into the others: https://www.iana.org/assignments/uri-schemes/prov/magnet I would also like to see nzblnk included ( https://nzblnk.info/ ) which would be useful for the existing sabnzbd package, once it is supported it could also be useful to add a package for https://github.com/Tensai75/nzb-monkey-go (pretty easy to install through go right now so not strictly necessary).

@agnostic-apollo
Copy link
Member

agnostic-apollo commented May 1, 2024

if that's alright

Of course it is.

Am I correct in assuming these changes will eventually be merged into the upstream termux/termux-app project

Yes, my local changes will be pushed to termux/termux-app for the next app version.

if I'm reading the code right and the old class got removed entirely this removes the support for magnet links right? I think they should still be supported

If you are referring to the TermuxUrlUtils class link, yes, it does not support magnet, but my local changes do support magnet and nzblnk. The new supported protocols are combination of the one in TermuxUrlUtils, Pattern.WEB_URL and your pull. Both TermuxUrlUtils and FileReceiverActivity class have been removed in my local changes with new implementation.

Currently, FileReceiverActivity for magnet and new protocols in your pull are using .* and .+ in url regex, which is wrong and breaks matching, as it matches any character until newline, and not just the ones supported by rfc, for example magnet:?xt=urn:btih:hash https://example.com would match as a single url as space character and later would get matched too.

magnet protocol also supports other URNs other than bith.

mailto protocol supports other formats too other than a single email.

xmpp (and possibly jabber) URIs may contain :// instead of just :.

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.

[Bug]: termux-file-editor running after sharing links with unknown/not included uri schemes
2 participants