BaseGitActivity: always enforce absolute URLs (#788)

This commit is contained in:
Harsh Shandilya 2020-05-24 16:15:07 +05:30 committed by GitHub
parent 0c45bffaba
commit f1befcf7f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -113,9 +113,7 @@ abstract class BaseGitActivity : AppCompatActivity() {
val portPart = val portPart =
if (serverPort == "22" || serverPort.isEmpty()) "" else ":$serverPort" if (serverPort == "22" || serverPort.isEmpty()) "" else ":$serverPort"
if (portPart.isEmpty()) { if (portPart.isEmpty()) {
// We only support relative paths with the standard port. "$userPart$hostnamePart:$serverPath"
val pathPart = serverPath.trimStart('/', ':')
"$userPart$hostnamePart:$pathPart"
} else { } else {
// Only absolute paths are supported with custom ports. // Only absolute paths are supported with custom ports.
if (!serverPath.startsWith('/')) if (!serverPath.startsWith('/'))