diff --git a/lbry/extras/daemon/json_response_encoder.py b/lbry/extras/daemon/json_response_encoder.py index cda561715..777154f6b 100644 --- a/lbry/extras/daemon/json_response_encoder.py +++ b/lbry/extras/daemon/json_response_encoder.py @@ -294,7 +294,7 @@ class JSONResponseEncoder(JSONEncoder): 'stopped': not managed_stream.running, 'stream_hash': None, 'stream_name': None, - 'suggested_file_name': None, + 'suggested_file_name': managed_stream.suggested_file_name, 'sd_hash': None, 'mime_type': managed_stream.mime_type, 'key': None, @@ -328,7 +328,6 @@ class JSONResponseEncoder(JSONEncoder): result.update({ 'stream_hash': managed_stream.stream_hash, 'stream_name': managed_stream.stream_name, - 'suggested_file_name': managed_stream.suggested_file_name, 'sd_hash': managed_stream.descriptor.sd_hash, 'key': managed_stream.descriptor.key, 'blobs_completed': managed_stream.blobs_completed, diff --git a/lbry/file/source.py b/lbry/file/source.py index f8bcbdd82..b44576dd2 100644 --- a/lbry/file/source.py +++ b/lbry/file/source.py @@ -92,6 +92,10 @@ class ManagedDownloadSource: def added_on(self) -> Optional[int]: return self._added_on + @property + def suggested_file_name(self): + return self._file_name + @property def status(self) -> str: return self._status diff --git a/tests/integration/datanetwork/test_file_commands.py b/tests/integration/datanetwork/test_file_commands.py index 93d06f499..25d87166d 100644 --- a/tests/integration/datanetwork/test_file_commands.py +++ b/tests/integration/datanetwork/test_file_commands.py @@ -86,6 +86,7 @@ class FileCommands(CommandTestCase): self.assertEqual(btih, file['metadata']['source']['bt_infohash']) self.assertAlmostEqual(time.time(), file['added_on'], delta=2) self.assertEqual("application/octet-stream", file['mime_type']) + self.assertEqual("tmp1", file['suggested_file_name']) self.assertIn(btih, self.client_session._handles) # stream over streaming API (full range of the largest file)