Inline images: use isMxcUrl()

Change-Id: Ie85c5597e714b48dc5bcd3ac69abb5161b4fa640
This commit is contained in:
SpiritCroc 2022-05-04 18:33:29 +02:00
parent 8158fff0f7
commit 3e2fdd0784

View file

@ -42,6 +42,7 @@ import io.noties.markwon.image.AsyncDrawable
import io.noties.markwon.image.glide.GlideImagesPlugin
import io.noties.markwon.inlineparser.MarkwonInlineParserPlugin
import org.commonmark.node.Node
import org.matrix.android.sdk.api.MatrixUrls.isMxcUrl
import timber.log.Timber
import javax.inject.Inject
import javax.inject.Singleton
@ -80,7 +81,7 @@ class EventHtmlRenderer @Inject constructor(
GlideImagesPlugin.create(object: GlideImagesPlugin.GlideStore {
override fun load(drawable: AsyncDrawable): RequestBuilder<Drawable> {
val url = drawable.destination
if (url.startsWith("mxc://")) {
if (url.isMxcUrl()) {
val contentUrlResolver = activeSessionHolder.getActiveSession().contentUrlResolver()
val imageUrl = contentUrlResolver.resolveFullSize(url)
return Glide.with(context).load(imageUrl)