mirror of
https://github.com/element-hq/synapse
synced 2024-08-19 18:30:24 +00:00
Fix logcontext leak in media repo
Make FileResponder.write_to_consumer uphold the logcontext contract
This commit is contained in:
parent
a8d8bf92e0
commit
be31adb036
2 changed files with 4 additions and 1 deletions
|
@ -143,6 +143,7 @@ def respond_with_responder(request, responder, media_type, file_size, upload_nam
|
|||
respond_404(request)
|
||||
return
|
||||
|
||||
logger.debug("Responding to media request with responder %s")
|
||||
add_file_headers(request, media_type, file_size, upload_name)
|
||||
with responder:
|
||||
yield responder.write_to_consumer(request)
|
||||
|
|
|
@ -255,7 +255,9 @@ class FileResponder(Responder):
|
|||
self.open_file = open_file
|
||||
|
||||
def write_to_consumer(self, consumer):
|
||||
return FileSender().beginFileTransfer(self.open_file, consumer)
|
||||
return make_deferred_yieldable(
|
||||
FileSender().beginFileTransfer(self.open_file, consumer)
|
||||
)
|
||||
|
||||
def __exit__(self, exc_type, exc_val, exc_tb):
|
||||
self.open_file.close()
|
||||
|
|
Loading…
Reference in a new issue