Fixed clone url replacing inbetween ".git" string (should only remove suffixes)

This commit is contained in:
Abdelilah El Aissaoui 2022-04-04 00:19:03 +02:00
parent c1fdd891c6
commit 11ea0986c3

View File

@ -47,7 +47,11 @@ class CloneViewModel @Inject constructor(
}
// Take the last element of the path/URL to generate obtain the repo name
val repoName = urlSplit.lastOrNull()?.replace(".git", "")
var repoName = urlSplit.lastOrNull()
if(repoName?.endsWith(".git") == true) {
repoName = repoName.removeSuffix(".git")
}
if (repoName.isNullOrBlank()) {
_cloneStatus.value = CloneStatus.Fail("Check your URL and try again")