Context
While attempting to automatically configure DAVx5 over (usb) adb, I noticed the port that I include in the intent, does not arrive at the DAVx5 app.
Example
I can run:
adb shell am start -a android.intent.action.VIEW -d caldavs://some_nextcloud_username:some_nextcloud_password@some_long_onion.onion:9001/remote.php/dav/principals/users/some_nextcloud_username
Which has output:
Starting: Intent { act=android.intent.action.VIEW dat=caldavs://some_nextcloud_username:some_nextcloud_password@some_long_onion.onion:9001/remote.php/dav/principals/users/some_nextcloud_username }
Warning: Activity not started, its current task has been brought to the front
However, in the app, that results in:
As one can see, the :9001 part is dropped from the url.
Verification
I verified that the port dropping out is indeed the issue, by manually adding the port into the url that is displayed, and pressing "Login", which yields a succesful login.
Question
How can I modify the adb command to ensure that the port is included in the url with which the DAVx5 tries to login?
Comment
In response to the comments, I have looked into the source code, and expect I should add something like .port(uri.port) after the .path(uri.path) line here:
intent.data?.normalizeScheme()?.let { uri ->
// We've got initial login data from the Intent.
// We can't use uri.buildUpon() because this keeps the user info (it's readable, but not writable).
val realScheme = when (uri.scheme) {
"caldav", "carddav" -> "http"
"caldavs", "carddavs", "davx5" -> "https"
"http", "https" -> uri.scheme
else -> null
}
if (realScheme != null) {
val realUri = Uri.Builder()
.scheme(realScheme)
.authority(uri.host)
.path(uri.path)
.query(uri.query)
givenUrl = realUri.build().toString()
// extract user info
uri.userInfo?.split(':')?.let { userInfo ->
givenUsername = userInfo.getOrNull(0)
givenPassword = userInfo.getOrNull(1)
}
}
}
I did not yet compile the source code to install the app and inspect whether that would add the port.