mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-05-02 12:44:05 -04:00
[db] Reject invalid URIs when adding repos
This commit is contained in:
committed by
Michael Pöhn
parent
aaa4b56a9d
commit
40c71e4b06
@@ -25,6 +25,7 @@ import org.fdroid.database.Repository
|
||||
import org.fdroid.database.RepositoryDaoInt
|
||||
import org.fdroid.download.DownloaderFactory
|
||||
import org.fdroid.download.HttpManager
|
||||
import org.fdroid.download.HttpManager.Companion.isInvalidHttpUrl
|
||||
import org.fdroid.download.NotFoundException
|
||||
import org.fdroid.index.IndexFormatVersion
|
||||
import org.fdroid.index.SigningException
|
||||
@@ -125,7 +126,11 @@ internal class RepoAdder(
|
||||
// get repo url and fingerprint
|
||||
val nUri = repoUriGetter.getUri(url)
|
||||
log.info("Parsed URI: $nUri")
|
||||
// TODO reject non-http(s) Uri here
|
||||
if (isInvalidHttpUrl(nUri.uri.toString())) {
|
||||
val e = IllegalArgumentException("Unsupported URI: ${nUri.uri}")
|
||||
addRepoState.value = AddRepoError(INVALID_INDEX, e)
|
||||
return
|
||||
}
|
||||
|
||||
// some plumping to receive the repo preview
|
||||
var receivedRepo: Repository? = null
|
||||
|
||||
Reference in New Issue
Block a user