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.kt10
-rw-r--r--app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt13
2 files changed, 21 insertions, 2 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 2c171762..6208f401 100644
--- a/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt
+++ b/app/src/main/kotlin/com/pitchedapps/frost/facebook/FbUrlFormatter.kt
@@ -82,7 +82,13 @@ class FbUrlFormatter(url: String) {
builder.append(cleaned)
if (queries.isNotEmpty()) {
builder.append("?")
- queries.forEach { (k, v) -> builder.append("$k=$v&") }
+ queries.forEach { (k, v) ->
+ if (v.isEmpty()) {
+ builder.append("$k&")
+ } else {
+ builder.append("$k=$v&")
+ }
+ }
}
return builder.removeSuffix("&").toString()
}
@@ -121,7 +127,7 @@ class FbUrlFormatter(url: String) {
*
* acontext is not required for "friends interested in" notifications
*/
- val discardableQueries = arrayOf("ref", "refid", "SharedWith")
+ val discardableQueries = arrayOf("ref", "refid", "SharedWith", "fbclid")
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 3bd59fd3..e2a6f4ae 100644
--- a/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
+++ b/app/src/test/kotlin/com/pitchedapps/frost/facebook/FbUrlTest.kt
@@ -71,6 +71,19 @@ class FbUrlTest {
}
@Test
+ fun valuelessQuery() {
+ val url = "$FB_URL_BASE?foo"
+ assertFbFormat(url, url)
+ }
+
+ @Test
+ fun fbclid() {
+ val url = "$FB_URL_BASE?foo&fbclid=abc&bar=bbb"
+ val formattedUrl = "$FB_URL_BASE?foo&bar=bbb"
+ assertFbFormat(formattedUrl, url)
+ }
+
+ @Test
fun doubleDash() {
assertFbFormat("${FB_URL_BASE}relative", "$FB_URL_BASE/relative")
}