From: Olaf Wintermann Date: Tue, 9 Jun 2026 15:01:07 +0000 (+0200) Subject: fix baseUri when loading content in the webview X-Git-Url: https://uap-core.de/gitweb/?a=commitdiff_plain;h=1a8b4bf92ca5b1b43e119db8ac4da181e6851694;p=rssreader.git fix baseUri when loading content in the webview --- diff --git a/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt b/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt index aa4e761..194fe1f 100644 --- a/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt +++ b/rss-application/src/main/kotlin/de/unixwork/rssreader/FeedList.kt @@ -7,6 +7,7 @@ import de.unixwork.ui.kotlin.ToolkitDispatcher import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch +import java.net.URI import java.time.ZoneId import java.time.format.DateTimeFormatter @@ -219,13 +220,20 @@ class FeedList(window: MainWindow) : Document() { fun updateWebView() { currentItem?.let { item -> + var baseUri = item.link + try { + val linkUri = URI(item.link) + baseUri = URI(linkUri.scheme, linkUri.userInfo, linkUri.host, linkUri.port, linkUri.path, null, null).toString() + } catch (e: Exception) { + e.printStackTrace() + } if(browser.booleanValue()) { webview.loadUrl(item.link) // TODO: enable when more browser features (go prev/next) are implemented //window.window.ui.setState(MainWindow.ITEM_INTERNAL_BROWSER) } else { val content = item.getContent() - webview.loadContent(item.link, content.text, content.type, "utf-8") + webview.loadContent(baseUri, content.text, content.type, "utf-8") window.window.unsetState(MainWindow.ITEM_INTERNAL_BROWSER) } }