Only try to convert mxc URL when the room actually has an avatar

This commit is contained in:
Eric Eastwood 2023-05-10 00:45:47 -05:00
parent e7023012cc
commit 2102e76d5e
1 changed files with 7 additions and 5 deletions

View File

@ -907,11 +907,13 @@ router.get(
const pageOptions = { const pageOptions = {
title: `${roomData.name} - Matrix Public Archive`, title: `${roomData.name} - Matrix Public Archive`,
description: `View the history of ${roomData.name} in the Matrix Public Archive`, description: `View the history of ${roomData.name} in the Matrix Public Archive`,
imageUrl: mxcUrlToHttpThumbnail({ imageUrl:
mxcUrl: roomData.avatarUrl, roomData.avatarUrl &&
homeserverUrl: matrixServerUrl, mxcUrlToHttpThumbnail({
size: 256, mxcUrl: roomData.avatarUrl,
}), homeserverUrl: matrixServerUrl,
size: 256,
}),
blockedBySafeSearch: isNsfw, blockedBySafeSearch: isNsfw,
entryPoint: 'client/js/entry-client-hydrogen.js', entryPoint: 'client/js/entry-client-hydrogen.js',
locationHref: urlJoin(basePath, req.originalUrl), locationHref: urlJoin(basePath, req.originalUrl),