added regex checker to check for bad file drop input
@@ -5,6 +5,7 @@ import multiprocessing
import os
import pkg_resources
import platform
+import re
import requests
from subprocess import check_output, Popen, PIPE
@@ -410,4 +411,18 @@ def DropLocation():
drop_location = os.path.join(PathDirs().base_dir, "vent.cfg")
template = Template(template=drop_location)
drop_loc = template.option("main", "files")[1]
- return drop_loc
+
+ # if there's an unsupported character, display an error
+ allowed_char = '[a-zA-Z0-9_\.\-~/]'
+ invalid = [d for d in drop_loc if not re.search(allowed_char, d)]
+
+ if not invalid:
+ # if there's a ~, expand it.
+ drop_loc = os.path.expanduser(drop_loc)
+
+ # then do absolute path
+ drop_loc = os.path.abspath(drop_loc)
+ return (True, drop_loc, invalid)
+
+ else:
+ return (False, "invalid path name: " + str(invalid))
