0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-26 15:33:54 +01:00

modules/media: Assert and condition remote download request isn't for my_host().

This commit is contained in:
Jason Volk 2019-03-07 15:02:43 -08:00
parent 80743b2fd5
commit 7ea83597e5

View file

@ -162,6 +162,13 @@ download(const string_view &server,
file_room_id(server, mediaid)
};
thread_local char rembuf[256];
if(remote && my_host(string(rembuf, remote)))
return room_id;
if(!remote && my_host(server))
return room_id;
download(server, mediaid, user_id, remote, room_id);
return room_id;
}
@ -278,6 +285,8 @@ download(const mutable_buffer &head_buf,
server::request::opts *const opts)
{
thread_local char rembuf[256];
assert(remote || !my_host(server));
assert(!remote || !my_host(string(rembuf, remote)));
if(!remote)
remote = server;