fix: remove whitespace & line break before opening URLs

This commit is contained in:
junkfood 2024-05-31 03:27:06 +08:00
parent 0f41e9243d
commit bddc8766ec
No known key found for this signature in database
GPG Key ID: 2EA5B648DB112A34

View File

@ -78,7 +78,7 @@ fun Context.openURL(
specificBrowser: OpenLinkSpecificBrowserPreference = OpenLinkSpecificBrowserPreference.default
) {
if (!url.isNullOrBlank()) {
val uri = url.toUri()
val uri = url.trim { it.isWhitespace() || it == '\n' }.toUri()
val intent = Intent(Intent.ACTION_VIEW, uri)
val customTabsIntent = CustomTabsIntent.Builder().setShowTitle(true).build()
try {