From 1a8b4bf92ca5b1b43e119db8ac4da181e6851694 Mon Sep 17 00:00:00 2001 From: Olaf Wintermann Date: Tue, 9 Jun 2026 17:01:07 +0200 Subject: [PATCH] fix baseUri when loading content in the webview --- .../src/main/kotlin/de/unixwork/rssreader/FeedList.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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) } } -- 2.52.0