1
0

util.make_dir: 0o700 permissions on folders (#4357)

This commit is contained in:
ghost43
2018-05-28 14:22:54 +02:00
committed by GitHub
parent dbec3af810
commit 9b7a449057
6 changed files with 21 additions and 28 deletions

View File

@@ -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)