From b000ef30990337e887644e3543b5eb9bdbdff94d Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Sun, 15 Sep 2019 17:06:03 -0700 Subject: [PATCH] Validate filenames, and require filenames be passed in, in website mode as well as share mode --- onionshare/__init__.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/onionshare/__init__.py b/onionshare/__init__.py index 7e7798f8..65e605f6 100644 --- a/onionshare/__init__.py +++ b/onionshare/__init__.py @@ -88,13 +88,14 @@ def main(cwd=None): else: mode = 'share' - # Make sure filenames given if not using receiver mode - if mode == 'share' and len(filenames) == 0: - parser.print_help() - sys.exit() + # In share an website mode, you must supply a list of filenames + if mode == 'share' or mode == 'website': + # Make sure filenames given if not using receiver mode + if len(filenames) == 0: + parser.print_help() + sys.exit() - # Validate filenames - if mode == 'share': + # Validate filenames valid = True for filename in filenames: if not os.path.isfile(filename) and not os.path.isdir(filename):