0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 07:23:53 +01:00

modules/media/media: Fix unnecessary remote stringifies.

This commit is contained in:
Jason Volk 2020-03-10 20:02:25 -07:00
parent 52fc42c239
commit 14fffaeded

View file

@ -221,8 +221,7 @@ ircd::m::media::file::download(const mxc &mxc,
file::room_id(mxc) file::room_id(mxc)
}; };
thread_local char rembuf[256]; if(remote && my_host(remote))
if(remote && my_host(string(rembuf, remote)))
return room_id; return room_id;
if(!remote && my_host(mxc.server)) if(!remote && my_host(mxc.server))
@ -293,7 +292,7 @@ try
if(content_type != head.content_type) log::dwarning if(content_type != head.content_type) log::dwarning
{ {
log, "Server %s claims thumbnail %s is '%s' but we think it is '%s'", log, "Server %s claims thumbnail %s is '%s' but we think it is '%s'",
string(remote), remote,
mxc.mediaid, mxc.mediaid,
head.content_type, head.content_type,
content_type, content_type,
@ -321,12 +320,11 @@ try
} }
catch(const ircd::server::unavailable &e) catch(const ircd::server::unavailable &e)
{ {
thread_local char rembuf[256];
throw m::error throw m::error
{ {
http::BAD_GATEWAY, "M_MEDIA_UNAVAILABLE", http::BAD_GATEWAY, "M_MEDIA_UNAVAILABLE",
"Server '%s' is not available for media for '%s/%s' :%s", "Server '%s' is not available for media for '%s/%s' :%s",
string(rembuf, remote), remote,
mxc.server, mxc.server,
mxc.mediaid, mxc.mediaid,
e.what() e.what()