Fix avatar URLs without mxc:// looking like they work when they actually don't. Fixes #85
This commit is contained in:
parent
ae7e9693fc
commit
3585ed9456
@ -214,10 +214,10 @@ export async function uploadAvatar(id, data, mime) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function getAvatarURL({ id, avatar_url }) {
|
export function getAvatarURL({ id, avatar_url }) {
|
||||||
avatar_url = avatar_url || ""
|
if (!avatar_url?.startsWith("mxc://")) {
|
||||||
if (avatar_url.startsWith("mxc://")) {
|
return null
|
||||||
avatar_url = avatar_url.substr("mxc://".length)
|
|
||||||
}
|
}
|
||||||
|
avatar_url = avatar_url.substr("mxc://".length)
|
||||||
return `${BASE_PATH}/proxy/${id}/_matrix/media/r0/download/${avatar_url}?access_token=${
|
return `${BASE_PATH}/proxy/${id}/_matrix/media/r0/download/${avatar_url}?access_token=${
|
||||||
localStorage.accessToken}`
|
localStorage.accessToken}`
|
||||||
}
|
}
|
||||||
|
@ -215,8 +215,12 @@ class Client extends BaseMainView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get avatarMXC() {
|
get avatarMXC() {
|
||||||
return this.state.avatar_url === "disable"
|
if (this.state.avatar_url === "disable") {
|
||||||
? this.props.entry.remote_avatar_url : this.state.avatar_url
|
return this.props.entry.remote_avatar_url
|
||||||
|
} else if (!this.state.avatar_url?.startsWith("mxc://")) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return this.state.avatar_url
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarURL() {
|
get avatarURL() {
|
||||||
|
Loading…
Reference in New Issue
Block a user