mirror of
https://github.com/f-droid/fdroidclient.git
synced 2026-06-07 15:34:50 -04:00
[db] Reject invalid URIs when adding repos
This commit is contained in:
committed by
Michael Pöhn
parent
aaa4b56a9d
commit
40c71e4b06
@@ -107,6 +107,26 @@ internal class RepoAdderTest {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testInvalidUri() = runTest {
|
||||
repoAdder.fetchRepositoryInt("irc://example.org/repo/") // invalid scheme
|
||||
|
||||
repoAdder.addRepoState.test {
|
||||
val state1 = awaitItem()
|
||||
assertIs<AddRepoError>(state1)
|
||||
assertEquals(INVALID_INDEX, state1.errorType)
|
||||
}
|
||||
|
||||
repoAdder.abortAddingRepo()
|
||||
repoAdder.fetchRepositoryInt("https://%-") // invalid hostname
|
||||
|
||||
repoAdder.addRepoState.test {
|
||||
val state1 = awaitItem()
|
||||
assertIs<AddRepoError>(state1)
|
||||
assertEquals(INVALID_INDEX, state1.errorType)
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testAddingMinRepo() = runTest {
|
||||
val url = "https://example.org/repo/"
|
||||
|
||||
Reference in New Issue
Block a user