mirror of
https://mau.dev/maunium/synapse.git
synced 2024-09-04 16:42:35 +00:00
sync in changes from matrixfederationclient
This commit is contained in:
parent
a8a5dd3b44
commit
0d3d7de6fc
@ -244,7 +244,7 @@ class SimpleHttpClient(object):
|
|||||||
# The two should be factored out.
|
# The two should be factored out.
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def get_file(self, url, output_stream, args={}, max_size=None):
|
def get_file(self, url, output_stream, max_size=None):
|
||||||
"""GETs a file from a given URL
|
"""GETs a file from a given URL
|
||||||
Args:
|
Args:
|
||||||
url (str): The URL to GET
|
url (str): The URL to GET
|
||||||
@ -299,7 +299,11 @@ class _ReadBodyToFileProtocol(protocol.Protocol):
|
|||||||
self.stream.write(data)
|
self.stream.write(data)
|
||||||
self.length += len(data)
|
self.length += len(data)
|
||||||
if self.max_size is not None and self.length >= self.max_size:
|
if self.max_size is not None and self.length >= self.max_size:
|
||||||
logger.warn("Requested URL is too large > %r bytes" % (self.max_size,))
|
self.deferred.errback(SynapseError(
|
||||||
|
502,
|
||||||
|
"Requested file is too large > %r bytes" % (self.max_size,),
|
||||||
|
Codes.TOO_LARGE,
|
||||||
|
))
|
||||||
self.deferred = defer.Deferred()
|
self.deferred = defer.Deferred()
|
||||||
self.transport.loseConnection()
|
self.transport.loseConnection()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user