mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-27 23:07:14 -05:00
Validate filenames, and require filenames be passed in, in website mode as well as share mode
This commit is contained in:
parent
bb0908d6a3
commit
b000ef3099
@ -88,13 +88,14 @@ def main(cwd=None):
|
|||||||
else:
|
else:
|
||||||
mode = 'share'
|
mode = 'share'
|
||||||
|
|
||||||
# Make sure filenames given if not using receiver mode
|
# In share an website mode, you must supply a list of filenames
|
||||||
if mode == 'share' and len(filenames) == 0:
|
if mode == 'share' or mode == 'website':
|
||||||
parser.print_help()
|
# Make sure filenames given if not using receiver mode
|
||||||
sys.exit()
|
if len(filenames) == 0:
|
||||||
|
parser.print_help()
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
# Validate filenames
|
# Validate filenames
|
||||||
if mode == 'share':
|
|
||||||
valid = True
|
valid = True
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
if not os.path.isfile(filename) and not os.path.isdir(filename):
|
if not os.path.isfile(filename) and not os.path.isdir(filename):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user