mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-22 00:00:51 -04:00
Validate filenames, and require filenames be passed in, in website mode as well as share mode
This commit is contained in:
parent
eced6fb9ce
commit
cc965a875c
1 changed files with 7 additions and 6 deletions
|
@ -88,13 +88,14 @@ def main(cwd=None):
|
||||||
else:
|
else:
|
||||||
mode = 'share'
|
mode = 'share'
|
||||||
|
|
||||||
|
# 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
|
# Make sure filenames given if not using receiver mode
|
||||||
if mode == 'share' and len(filenames) == 0:
|
if len(filenames) == 0:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit()
|
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…
Add table
Add a link
Reference in a new issue