From 7ea83597e5c9b70751577b9b6b51de8fc958e1ed Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 7 Mar 2019 15:02:43 -0800 Subject: [PATCH] modules/media: Assert and condition remote download request isn't for my_host(). --- modules/media/media.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/modules/media/media.cc b/modules/media/media.cc index 25ba3fe69..232c03823 100644 --- a/modules/media/media.cc +++ b/modules/media/media.cc @@ -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;