Startup parameter fixups

This commit is contained in:
Sebastian Lohff 2012-06-26 02:40:41 +02:00
parent 12169eafe4
commit d628770d73
1 changed files with 5 additions and 1 deletions

View File

@ -994,10 +994,14 @@ def main():
print("Error: Maximum upload size can only be specified when in upload mode.")
sys.exit(1)
if args.upload and args.list_dir:
print("Error: Upload and dirlisting can't be enabled together.")
sys.exit(1)
if args.max_upload_size:
sizeRe = re.match("^(\d+(?:[,.]\d+)?)(?:([bkmgtpe])(?:(?<!b)b?)?)?$", args.max_upload_size.lower())
if not sizeRe:
print("Error: Your max upload size param is broken, try something like 3M or 2,5Gb.")
print("Error: Your max upload size param is broken. Try something like 3M or 2.5Gb.")
sys.exit(1)
uploadSize, modifier = sizeRe.groups()
uploadSize = float(uploadSize.replace(",", "."))