mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-02 20:54:19 -04:00
[db] return error when trying to add archive repo
This commit is contained in:
@@ -37,6 +37,7 @@ import org.fdroid.index.TempFileProvider
|
||||
import org.fdroid.repo.AddRepoError.ErrorType.INVALID_FINGERPRINT
|
||||
import org.fdroid.repo.AddRepoError.ErrorType.INVALID_INDEX
|
||||
import org.fdroid.repo.AddRepoError.ErrorType.IO_ERROR
|
||||
import org.fdroid.repo.AddRepoError.ErrorType.IS_ARCHIVE_REPO
|
||||
import org.fdroid.repo.AddRepoError.ErrorType.UNKNOWN_SOURCES_DISALLOWED
|
||||
import java.io.IOException
|
||||
import java.net.Proxy
|
||||
@@ -82,6 +83,7 @@ public data class AddRepoError(
|
||||
public enum class ErrorType {
|
||||
UNKNOWN_SOURCES_DISALLOWED,
|
||||
INVALID_FINGERPRINT,
|
||||
IS_ARCHIVE_REPO,
|
||||
INVALID_INDEX,
|
||||
IO_ERROR,
|
||||
}
|
||||
@@ -141,6 +143,10 @@ internal class RepoAdder(
|
||||
addRepoState.value = AddRepoError(INVALID_INDEX, e)
|
||||
return
|
||||
}
|
||||
if (nUri.uri.lastPathSegment == "archive") {
|
||||
addRepoState.value = AddRepoError(IS_ARCHIVE_REPO)
|
||||
return
|
||||
}
|
||||
|
||||
// some plumping to receive the repo preview
|
||||
var receivedRepo: Repository? = null
|
||||
|
||||
@@ -49,10 +49,12 @@ internal object RepoUriGetter {
|
||||
// do some path auto-adding, if it is missing
|
||||
if (pathSegments.size >= 2 &&
|
||||
pathSegments[pathSegments.lastIndex - 1] == "fdroid" &&
|
||||
pathSegments.last() == "repo"
|
||||
(pathSegments.last() == "repo" || pathSegments.last() == "archive")
|
||||
) {
|
||||
// path already is /fdroid/repo, use as is
|
||||
} else if (pathSegments.lastOrNull() == "repo") {
|
||||
} else if (pathSegments.lastOrNull() == "repo" ||
|
||||
pathSegments.lastOrNull() == "archive"
|
||||
) {
|
||||
// path already ends in /repo, use as is
|
||||
} else if (pathSegments.size >= 1 && pathSegments.last() == "fdroid") {
|
||||
// path is /fdroid with missing /repo, so add that
|
||||
|
||||
Reference in New Issue
Block a user