Validate filenames, and require filenames be passed in, in website mode as well as share mode

This commit is contained in:
Micah Lee 2019-09-15 17:06:03 -07:00
parent bb0908d6a3
commit b000ef3099
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73

View File

@ -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):