util.make_dir: 0o700 permissions on folders (#4357)
This commit is contained in:
10
lib/util.py
10
lib/util.py
@@ -30,6 +30,7 @@ import traceback
|
||||
import urllib
|
||||
import threading
|
||||
import hmac
|
||||
import stat
|
||||
|
||||
from .i18n import _
|
||||
|
||||
@@ -880,3 +881,12 @@ def export_meta(meta, fileName):
|
||||
except (IOError, os.error) as e:
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
raise FileExportFailed(e)
|
||||
|
||||
|
||||
def make_dir(path, allow_symlink=True):
|
||||
"""Make directory if it does not yet exist."""
|
||||
if not os.path.exists(path):
|
||||
if not allow_symlink and os.path.islink(path):
|
||||
raise Exception('Dangling link: ' + path)
|
||||
os.mkdir(path)
|
||||
os.chmod(path, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR)
|
||||
|
||||
Reference in New Issue
Block a user