From b134e0c9c906de8defabcff940cfe2796d9a59d4 Mon Sep 17 00:00:00 2001 From: Jack Robison Date: Wed, 1 May 2019 14:24:19 -0400 Subject: [PATCH] fix blob_get --- lbrynet/extras/daemon/Daemon.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 59e1b72e5..fb2d5b79d 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -2927,10 +2927,12 @@ class Daemon(metaclass=JSONRPCServerType): blob = await download_blob(asyncio.get_event_loop(), self.conf, self.blob_manager, self.dht_node, blob_hash) if read: - with open(blob.file_path, 'rb') as handle: + with blob.reader_context() as handle: return handle.read().decode() - else: - return "Downloaded blob %s" % blob_hash + elif isinstance(blob, BlobBuffer): + log.warning("manually downloaded blob buffer could have missed garbage collection, clearing it") + blob.delete() + return "Downloaded blob %s" % blob_hash @requires(BLOB_COMPONENT, DATABASE_COMPONENT) async def jsonrpc_blob_delete(self, blob_hash):