fix suggested_file_name for torrent on json encoder
This commit is contained in:
parent
2bf0ca6441
commit
732b7e79d7
3 changed files with 6 additions and 2 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue