diff --git a/lbry/extras/daemon/daemon.py b/lbry/extras/daemon/daemon.py index 73f0388c1..ad5cf60ed 100644 --- a/lbry/extras/daemon/daemon.py +++ b/lbry/extras/daemon/daemon.py @@ -3495,9 +3495,10 @@ class Daemon(metaclass=JSONRPCServerType): if replace: claim = Claim() - claim.stream.message.source.CopyFrom( - old_txo.claim.stream.message.source - ) + if old_txo.claim.stream.has_source: + claim.stream.message.source.CopyFrom( + old_txo.claim.stream.message.source + ) stream_type = old_txo.claim.stream.stream_type if stream_type: old_stream_type = getattr(old_txo.claim.stream.message, stream_type) diff --git a/lbry/schema/claim.py b/lbry/schema/claim.py index 9b256258f..b75945480 100644 --- a/lbry/schema/claim.py +++ b/lbry/schema/claim.py @@ -303,6 +303,10 @@ class Stream(BaseClaim): def has_fee(self) -> bool: return self.message.HasField('fee') + @property + def has_source(self) -> bool: + return self.message.HasField('source') + @property def source(self) -> Source: return Source(self.message.source) diff --git a/tests/integration/blockchain/test_claim_commands.py b/tests/integration/blockchain/test_claim_commands.py index 582b30868..a0d1ce543 100644 --- a/tests/integration/blockchain/test_claim_commands.py +++ b/tests/integration/blockchain/test_claim_commands.py @@ -1898,6 +1898,16 @@ class StreamCommands(ClaimTestCase): self.assertEqual(claim['value']['tags'], ['anime']) self.assertNotIn('source', claim['value']) + # change metadata before the release + await self.publish( + 'future-release', bid='0.1', tags=['Anime', 'anime ', 'psy-trance'], title='Psy will be over 9000!!!' + ) + self.assertItemCount(await self.daemon.jsonrpc_file_list(), 2) + claim = await self.resolve('lbry://future-release') + self.assertEqual(claim['value']['tags'], ['anime', 'psy-trance']) + self.assertEqual(claim['value']['title'], 'Psy will be over 9000!!!') + self.assertNotIn('source', claim['value']) + # update the stream to have a source with tempfile.NamedTemporaryFile() as file: file.write(b'hi')