Merge pull request #1932 from lbryio/fix-1930

Fix blob_list for sd_hash including stream terminator
This commit is contained in:
Jack Robison 2019-02-18 14:41:00 -05:00 committed by GitHub
commit fa7e9923f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2588,7 +2588,8 @@ class Daemon(metaclass=JSONRPCServerType):
Returns: Returns:
(str) Success/fail message (str) Success/fail message
""" """
if not blob_hash or not is_valid_blobhash(blob_hash):
return f"Invalid blob hash to delete '{blob_hash}'"
streams = self.stream_manager.get_filtered_streams(sd_hash=blob_hash) streams = self.stream_manager.get_filtered_streams(sd_hash=blob_hash)
if streams: if streams:
await self.stream_manager.delete_stream(streams[0]) await self.stream_manager.delete_stream(streams[0])
@ -2718,7 +2719,7 @@ class Daemon(metaclass=JSONRPCServerType):
else: else:
blobs = [] blobs = []
if stream_hash: if stream_hash:
blobs.extend([b.blob_hash for b in await self.storage.get_blobs_for_stream(stream_hash)]) blobs.extend([b.blob_hash for b in (await self.storage.get_blobs_for_stream(stream_hash))[:-1]])
else: else:
blobs = list(self.blob_manager.completed_blob_hashes) blobs = list(self.blob_manager.completed_blob_hashes)
if needed: if needed: