mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-24 19:56:00 +00:00
Use URL for S3.
Thanks to Oscar Mira <valldrac@molly.im> for bringing this to our attention.
This commit is contained in:
@@ -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")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user