Skip to content
This repository was archived by the owner on Apr 2, 2024. It is now read-only.

Commit 7b56835

Browse files
committed
Utilize android Uri instead of java URI for better character set handling
1 parent 54f0cdb commit 7b56835

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

app/src/main/java/acr/browser/lightning/adblock/BloomFilterAdBlocker.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ import acr.browser.lightning.di.MainScheduler
1818
import acr.browser.lightning.extensions.toast
1919
import acr.browser.lightning.log.Logger
2020
import android.app.Application
21+
import android.net.Uri
2122
import io.reactivex.Maybe
2223
import io.reactivex.Scheduler
2324
import io.reactivex.Single
2425
import io.reactivex.disposables.CompositeDisposable
2526
import io.reactivex.rxkotlin.plusAssign
2627
import io.reactivex.rxkotlin.subscribeBy
27-
import java.net.URI
2828
import java.net.URISyntaxException
2929
import javax.inject.Inject
3030
import javax.inject.Singleton
@@ -155,7 +155,7 @@ class BloomFilterAdBlocker @Inject constructor(
155155
* Extract the [Host] from a [String] representing a URL. Returns null if no host was extracted.
156156
*/
157157
private fun String.host(): Host? = try {
158-
URI(this).host?.let(::Host)
158+
Uri.parse(this).host?.let(::Host)
159159
} catch (exception: URISyntaxException) {
160160
logger.log(TAG, "Invalid URL: $this", exception)
161161
null

0 commit comments

Comments
 (0)