diff --git a/code/app.py b/code/app.py index f856521..3bf92e2 100644 --- a/code/app.py +++ b/code/app.py @@ -314,8 +314,7 @@ def get_share(name, require_auth = True): "authenticated": authenticated }) if not os.path.exists(share['path']): - os.makedirs(share['path']) - set_rights(share['path']) + makedirs_rights(share['path']) return (True,share) def is_expired(share): @@ -330,6 +329,16 @@ def print_debug(s): sys.stderr.write(str(s)+"\n") sys.stderr.flush() +def makedirs_rights(path): + # os.makedirs with chown + path_list = path.split(os.sep) + for p in range(len(path_list)): + current_path = os.sep.join(path_list[0:(p+1)]) + if not os.path.exists(current_path): + os.mkdir(current_path) + set_rights(current_path) + + def set_rights(path): os.chown(path, app.config['UID'], app.config['GID']) st = os.stat(path) diff --git a/utils/flees-manager.py b/utils/flees-manager.py index 39138a3..209e916 100755 --- a/utils/flees-manager.py +++ b/utils/flees-manager.py @@ -291,7 +291,7 @@ def print_rest_api(shares, config, opts): share['name'], share['pass_hash'] )) - print("or \n\n# curl -s %s/script/upload/%s/%s | bash /dev/stdin file_to_upload.ext"%( + print("or \n\n# curl -s %s/script/upload/%s/%s | bash /dev/stdin file_to_upload.ext [second.file.ext]"%( config['public_url'], share['name'], share['pass_hash']