From e97c95f40a7392b1ecf300ae2ce9ed180b8ad56b Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Wed, 15 Apr 2020 18:03:20 +0200 Subject: [PATCH] Fix issue with media path (Fixes #1227) --- CHANGES.md | 2 +- .../internal/session/content/DefaultContentUrlResolver.kt | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 15c7493ade..5adf431eae 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -7,7 +7,6 @@ Features ✨: - Cross-Signing | Verify new session from existing session (#1134) - Cross-Signing | Bootstraping cross signing with 4S from mobile (#985) - Improvements 🙌: - Verification DM / Handle concurrent .start after .ready (#794) - Reimplementation of multiple attachment picker @@ -34,6 +33,7 @@ Bugfix 🐛: - Fix crash when trying to download file without internet connection (#1229) - Local echo are not updated in timeline (for failed & encrypted states) - Render image event even if thumbnail_info does not have mimetype defined (#1209) + - Fix issue with media path (#1227) Translations 🗣: - diff --git a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/DefaultContentUrlResolver.kt b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/DefaultContentUrlResolver.kt index f288f949cd..20c124f545 100644 --- a/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/DefaultContentUrlResolver.kt +++ b/matrix-sdk-android/src/main/java/im/vector/matrix/android/internal/session/content/DefaultContentUrlResolver.kt @@ -18,10 +18,10 @@ package im.vector.matrix.android.internal.session.content import im.vector.matrix.android.api.auth.data.HomeServerConnectionConfig import im.vector.matrix.android.api.session.content.ContentUrlResolver +import im.vector.matrix.android.internal.network.NetworkConstants import javax.inject.Inject private const val MATRIX_CONTENT_URI_SCHEME = "mxc://" -private const val URI_PREFIX_CONTENT_API = "_matrix/media/v1/" internal class DefaultContentUrlResolver @Inject constructor(private val homeServerConnectionConfig: HomeServerConnectionConfig) : ContentUrlResolver { @@ -30,14 +30,14 @@ internal class DefaultContentUrlResolver @Inject constructor(private val homeSer val baseUrl = homeServerConnectionConfig.homeServerUri.toString() val sep = if (baseUrl.endsWith("/")) "" else "/" - return baseUrl + sep + URI_PREFIX_CONTENT_API + "upload" + return baseUrl + sep + NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "upload" } } override fun resolveFullSize(contentUrl: String?): String? { if (contentUrl?.isValidMatrixContentUrl() == true) { val baseUrl = homeServerConnectionConfig.homeServerUri.toString() - val prefix = URI_PREFIX_CONTENT_API + "download/" + val prefix = NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "download/" return resolve(baseUrl, contentUrl, prefix) } return null @@ -46,7 +46,7 @@ internal class DefaultContentUrlResolver @Inject constructor(private val homeSer override fun resolveThumbnail(contentUrl: String?, width: Int, height: Int, method: ContentUrlResolver.ThumbnailMethod): String? { if (contentUrl?.isValidMatrixContentUrl() == true) { val baseUrl = homeServerConnectionConfig.homeServerUri.toString() - val prefix = URI_PREFIX_CONTENT_API + "thumbnail/" + val prefix = NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "thumbnail/" val params = "?width=$width&height=$height&method=${method.value}" return resolve(baseUrl, contentUrl, prefix, params) }