aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt2
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt24
2 files changed, 20 insertions, 6 deletions
diff --git a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt
index 16cbc9c8..2b576ae1 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt
@@ -137,7 +137,7 @@ class FbUrlFormatter(url: String) {
*
* acontext is not required for "friends interested in" notifications
*/
- val discardableQueries = arrayOf("ref", "refid", "SharedWith", "fbclid")
+ val discardableQueries = arrayOf("ref", "refid", "SharedWith", "fbclid", "_ft_")
val converter = listOf(
"\\3C " to "%3C", "\\3E " to "%3E", "\\23 " to "%23", "\\25 " to "%25",
diff --git a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
index ca842ed9..7e13e6dc 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
@@ -31,7 +31,11 @@ class FbUrlTest {
@Suppress("NOTHING_TO_INLINE")
inline fun assertFbFormat(expected: String, url: String) {
val fbUrl = FbUrlFormatter(url)
- assertEquals(expected, fbUrl.toString(), "FbUrl Mismatch:\n${fbUrl.toLogList().joinToString("\n\t")}")
+ assertEquals(
+ expected,
+ fbUrl.toString(),
+ "FbUrl Mismatch:\n${fbUrl.toLogList().joinToString("\n\t")}"
+ )
}
@Test
@@ -65,8 +69,10 @@ class FbUrlTest {
@Test
fun ampersand() {
- val url = "https://scontent-yyz1-1.xx.fbcdn.net/v/t31.0-8/fr/cp0/e15/q65/123.jpg?_nc_cat=0&efg=asdf"
- val formattedUrl = "https://scontent-yyz1-1.xx.fbcdn.net/v/t31.0-8/fr/cp0/e15/q65/123.jpg?_nc_cat=0&efg=asdf"
+ val url =
+ "https://scontent-yyz1-1.xx.fbcdn.net/v/t31.0-8/fr/cp0/e15/q65/123.jpg?_nc_cat=0&efg=asdf"
+ val formattedUrl =
+ "https://scontent-yyz1-1.xx.fbcdn.net/v/t31.0-8/fr/cp0/e15/q65/123.jpg?_nc_cat=0&efg=asdf"
assertFbFormat(formattedUrl, url)
}
@@ -101,7 +107,7 @@ class FbUrlTest {
val url =
"/video_redirect/?src=https%3A%2F%2Fvideo-yyz1-1.xx.fbcdn.net%2Fv%2Ft42.1790-2%2F2349078999904_n.mp4%3Fefg%3DeyJ87J9%26oh%3Df5777784%26oe%3D56FD4&source=media_collage&id=1735049&refid=8&_ft_=qid.6484464%3Amf_story_key.-43172431214%3Atop_level_post_id.102773&__tn__=FEH-R"
val expected =
- "https://video-yyz1-1.xx.fbcdn.net/v/t42.1790-2/2349078999904_n.mp4?efg=eyJ87J9&oh=f5777784&oe=56FD4&source=media_collage&id=1735049&_ft_=qid.6484464:mf_story_key.-43172431214:top_level_post_id.102773&__tn__=FEH-R"
+ "https://video-yyz1-1.xx.fbcdn.net/v/t42.1790-2/2349078999904_n.mp4?efg=eyJ87J9&oh=f5777784&oe=56FD4&source=media_collage&id=1735049&__tn__=FEH-R"
assertFbFormat(expected, url)
}
@@ -138,10 +144,18 @@ class FbUrlTest {
@Test
fun viewFullImage() {
- val url = "https://scontent-yyz1-1.xx.fbcdn.net/v/t1.0-9/fr/cp0/e15/q65/asdf_n.jpg?efg=asdf&oh=asdf&oe=asdf"
+ val url =
+ "https://scontent-yyz1-1.xx.fbcdn.net/v/t1.0-9/fr/cp0/e15/q65/asdf_n.jpg?efg=asdf&oh=asdf&oe=asdf"
assertFbFormat(url, "#!$url")
}
+ @Test
+ fun queryFt() {
+ val url = "${FB_URL_BASE}sample/photos/a.12346/?source=48&_ft_=xxx"
+ val expected = "${FB_URL_BASE}sample/photos/a.12346/?source=48"
+ assertFbFormat(expected, url)
+ }
+
// @Test
// fun viewFullImageIndirect() {
// val urlBase = "photo/view_full_size/?fbid=1234&ref_component=mbasic_photo_permalink&ref_page=%2Fwap%2Fphoto.php&refid=13&_ft_=qid.1234%3Amf_story_key.1234%3Atop_level_post_id"