aboutsummaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorAllan Wang <me@allanwang.ca>2019-08-19 23:53:02 -0700
committerAllan Wang <me@allanwang.ca>2019-08-19 23:53:16 -0700
commitde4f6072f4318661734acd57ca1684a002f68f45 (patch)
treec706566913cd80d79bdcae5502f70fde246ba2a7 /app
parent2ce40832f715b2a867fa98480ec55a9f6bdfb109 (diff)
downloadfrost-de4f6072f4318661734acd57ca1684a002f68f45.tar.gz
frost-de4f6072f4318661734acd57ca1684a002f68f45.tar.bz2
frost-de4f6072f4318661734acd57ca1684a002f68f45.zip
Remove _ft_ query, resolves #1506
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.kt22
2 files changed, 19 insertions, 5 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..5e1082d7 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&amp;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&amp;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)
}
@@ -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"