Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,14 @@ class WebViewState(
byline = article.byline(context = webView.context),
colors = colors
)
//Pass in the base URL so that images with relative paths can be displayed properly.
val baseUrl = article.url.toString()?.let { url ->
val index = url.lastIndexOf('/') + 1
url.substring(0, index)
} ?: article.siteURL

webView.loadDataWithBaseURL(
null,
baseUrl,
html,
null,
"UTF-8",
Expand Down
8 changes: 4 additions & 4 deletions capy/src/main/java/com/jocmp/capy/articles/ArticleRenderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ class ArticleRenderer(
} else {
article.siteURL?.let { document.setBaseUri(it) }
}

HtmlPostProcessor.clean(contentHTML, hideImages = hideImages)
//do not clean, when website use images of relative path, this code will clean wrongly
//HtmlPostProcessor.clean(contentHTML, hideImages = hideImages)

document.content?.append(
parseHtml(
Expand All @@ -89,8 +89,8 @@ class ArticleRenderer(
}

document.content?.append(article.content)

HtmlPostProcessor.clean(document, hideImages = hideImages)
//do not clean, when website use images of relative path, this code will clean wrongly
//HtmlPostProcessor.clean(document, hideImages = hideImages)
}

return document.html()
Expand Down