Use URL for S3.

Thanks to Oscar Mira <valldrac@molly.im> for bringing this to our attention.
This commit is contained in:
Cody Henthorne
2024-06-20 12:15:49 -04:00
committed by GitHub
parent 4b8546a151
commit 230de7e9dc
3 changed files with 59 additions and 5 deletions

View File

@@ -0,0 +1,31 @@
/*
* Copyright 2024 Signal Messenger, LLC
* SPDX-License-Identifier: AGPL-3.0-only
*/
package org.thoughtcrime.securesms.s3
import okio.IOException
import org.junit.Test
import org.thoughtcrime.securesms.assertIs
@Suppress("ClassName")
class S3Test_getS3Url {
@Test
fun validS3Urls() {
S3.s3Url("/static/heart.png").toString() assertIs "https://updates2.signal.org/static/heart.png"
S3.s3Url("/static/heart.png?weee=1").toString() assertIs "https://updates2.signal.org/static/heart.png%3Fweee=1"
S3.s3Url("/@signal.org").toString() assertIs "https://updates2.signal.org/@signal.org"
}
@Test(expected = IOException::class)
fun invalid() {
S3.s3Url("@signal.org")
}
@Test(expected = IOException::class)
fun invalidRelative() {
S3.s3Url("static/heart.png")
}
}