From 4c23add19384a6c9f9579d386c5923bee5816f52 Mon Sep 17 00:00:00 2001 From: Thomas Zarebczan Date: Thu, 10 Jan 2019 22:05:39 -0500 Subject: [PATCH] fix unavailable download directory If an uploaded file had a directory that was removed, or if the old download directory doesn't exist, use the default. --- lbrynet/extras/daemon/Daemon.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lbrynet/extras/daemon/Daemon.py b/lbrynet/extras/daemon/Daemon.py index 99bdaf98f..b6f9adb22 100644 --- a/lbrynet/extras/daemon/Daemon.py +++ b/lbrynet/extras/daemon/Daemon.py @@ -834,7 +834,10 @@ class Daemon(metaclass=JSONRPCServerType): async def _get_lbry_file_dict(self, lbry_file): key = hexlify(lbry_file.key) if lbry_file.key else None - full_path = os.path.join(lbry_file.download_directory, lbry_file.file_name) + download_directory = lbry_file.download_directory + if not os.path.exists(download_directory): + download_directory = conf.settings.download_dir + full_path = os.path.join(download_directory, lbry_file.file_name) mime_type = guess_media_type(lbry_file.file_name) if os.path.isfile(full_path): with open(full_path) as written_file: @@ -852,7 +855,7 @@ class Daemon(metaclass=JSONRPCServerType): return { 'completed': lbry_file.completed, 'file_name': lbry_file.file_name, - 'download_directory': lbry_file.download_directory, + 'download_directory': download_directory, 'points_paid': lbry_file.points_paid, 'stopped': lbry_file.stopped, 'stream_hash': lbry_file.stream_hash,