diff --git a/CHANGELOG.md b/CHANGELOG.md index 5de1f3825..5012be174 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ at anytime. ## [Unreleased] ### Added - * + * Prevent publish of files with size 0 * ### Changed diff --git a/lbrynet/lbrynet_daemon/Publisher.py b/lbrynet/lbrynet_daemon/Publisher.py index 56438219c..9b0fb3e35 100644 --- a/lbrynet/lbrynet_daemon/Publisher.py +++ b/lbrynet/lbrynet_daemon/Publisher.py @@ -24,6 +24,11 @@ class Publisher(object): def create_and_publish_stream(self, name, bid, claim_dict, file_path): """Create lbry file and make claim""" log.info('Starting publish for %s', name) + if not os.path.isfile(file_path): + raise Exception("File {} not found".format(file_path)) + if os.path.getsize(file_path) == 0: + raise Exception("Cannot publish empty file {}".format(file_path)) + file_name = os.path.basename(file_path) with file_utils.get_read_handle(file_path) as read_handle: stream_hash = yield create_lbry_file(self.session, self.lbry_file_manager, file_name,