From 2f7b98c064cd35c6fd2c132a31a3c1b34797067c Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Mon, 26 Sep 2022 22:36:02 -0700 Subject: [PATCH] Fixed URL encoding --- build.gradle | 4 ++-- src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt | 3 +++ src/test/kotlin/net/thauvin/erik/mobibot/UtilsTest.kt | 2 +- version.properties | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index 49d1823..5d94eaa 100644 --- a/build.gradle +++ b/build.gradle @@ -65,7 +65,7 @@ dependencies { implementation 'org.jetbrains.kotlinx:kotlinx-cli:0.3.5' // Logging - implementation 'org.slf4j:slf4j-api:2.0.1' + implementation 'org.slf4j:slf4j-api:2.0.2' implementation "org.apache.logging.log4j:log4j-api:$versions.log4j" implementation "org.apache.logging.log4j:log4j-core:$versions.log4j" implementation "org.apache.logging.log4j:log4j-slf4j2-impl:$versions.log4j" @@ -74,7 +74,7 @@ dependencies { implementation 'com.squareup.okhttp3:okhttp:4.10.0' implementation 'net.aksingh:owm-japis:2.5.3.0' implementation 'net.objecthunter:exp4j:0.4.8' - implementation 'org.json:json:20220320' + implementation 'org.json:json:20220924' implementation 'org.jsoup:jsoup:1.15.3' implementation 'org.twitter4j:twitter4j-core:4.0.7' diff --git a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt index fff80ae..1ff6300 100644 --- a/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt +++ b/src/main/kotlin/net/thauvin/erik/mobibot/Utils.kt @@ -141,6 +141,9 @@ object Utils { */ @JvmStatic fun String.encodeUrl(): String = URLEncoder.encode(this, StandardCharsets.UTF_8) + .replace("+", "%20") + .replace("*", "%2A") + .replace("%7E", "~") /** * Returns a property as an int. diff --git a/src/test/kotlin/net/thauvin/erik/mobibot/UtilsTest.kt b/src/test/kotlin/net/thauvin/erik/mobibot/UtilsTest.kt index 2e5b7e9..4797369 100644 --- a/src/test/kotlin/net/thauvin/erik/mobibot/UtilsTest.kt +++ b/src/test/kotlin/net/thauvin/erik/mobibot/UtilsTest.kt @@ -144,7 +144,7 @@ class UtilsTest { @Test fun testEncodeUrl() { - assertThat("Hello Günter".encodeUrl()).isEqualTo("Hello+G%C3%BCnter") + assertThat("Hello Günter".encodeUrl()).isEqualTo("Hello%20G%C3%BCnter") } @Test diff --git a/version.properties b/version.properties index f527416..e4cf939 100644 --- a/version.properties +++ b/version.properties @@ -1,9 +1,9 @@ #Generated by the Semver Plugin for Gradle -#Sat Sep 24 10:52:55 PDT 2022 -version.buildmeta=676 +#Sat Sep 24 22:15:01 PDT 2022 +version.buildmeta=677 version.major=0 version.minor=8 version.patch=0 version.prerelease=rc version.project=mobibot -version.semver=0.8.0-rc+676 +version.semver=0.8.0-rc+677