Skip to content

Commit

Permalink
Fix thumbnail request for with media proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
yostyle committed Feb 25, 2025
1 parent 1358ff1 commit a77dbce
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ internal class DefaultFileService @Inject constructor(
.url(resolvedMethod.url)
.header(DOWNLOAD_PROGRESS_INTERCEPTOR_HEADER, url)

if (isAuthenticatedMediaSupported()) {
if (contentUrlResolver.requiresAuthentication(resolvedMethod.url)) {
val accessToken = accessTokenProvider.getToken()
requestBuilder.addAuthenticationHeader(accessToken)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ internal class DefaultContentUrlResolver @Inject constructor(

private val baseUrl = homeServerConnectionConfig.homeServerUriBase.toString().ensureTrailingSlash()
private val authenticatedMediaApiPath = baseUrl + NetworkConstants.URI_API_PREFIX_PATH_V1 + "media/"
private val mediaProxyApiPath = baseUrl + NetworkConstants.URI_API_PREFIX_PATH_MEDIA_PROXY_UNSTABLE
override val uploadUrl = baseUrl + NetworkConstants.URI_API_MEDIA_PREFIX_PATH_R0 + "upload"

override fun resolveForDownload(contentUrl: String?, elementToDecrypt: ElementToDecrypt?): ContentUrlResolver.ResolvedMethod? {
Expand Down Expand Up @@ -83,7 +84,7 @@ internal class DefaultContentUrlResolver @Inject constructor(
}

override fun requiresAuthentication(resolvedUrl: String): Boolean {
return resolvedUrl.startsWith(authenticatedMediaApiPath)
return resolvedUrl.startsWith(mediaProxyApiPath) && isAuthenticatedMediaSupported() || resolvedUrl.startsWith(authenticatedMediaApiPath)
}

private fun resolve(
Expand Down
10 changes: 0 additions & 10 deletions vector/src/main/java/im/vector/app/features/home/AvatarRenderer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -284,16 +284,6 @@ class AvatarRenderer @Inject constructor(
}
}

@AnyThread
fun getSpacePlaceholderDrawable(matrixItem: MatrixItem): Drawable {
val avatarColor = matrixItemColorProvider.getColor(matrixItem)
return TextDrawable.builder()
.beginConfig()
.bold()
.endConfig()
.buildRoundRect(matrixItem.firstLetterOfDisplayName(), avatarColor, dimensionConverter.dpToPx(8))
}

// PRIVATE API *********************************************************************************

private fun GlideRequests.loadResolvedUrl(avatarUrl: String?): GlideRequest<Drawable> {
Expand Down

0 comments on commit a77dbce

Please sign in to comment.