Skip to content
Snippets Groups Projects
Commit a6e86a25 authored by Andri Joos's avatar Andri Joos :blush:
Browse files

fix relative file path error

parent 9bf4502a
No related branches found
No related tags found
No related merge requests found
......@@ -40,7 +40,9 @@ def create_client(server_address: str = None, username: str = None, password: st
def upload(_in: str, out: str, server_address: str = None, username: str = None, password: str = None, public_link: str = None, func=None):
nc = create_client(server_address, username, password, public_link)
files_and_directories = glob.glob(os.path.join(_in, "**/*"), recursive=True)
search_path = os.path.join(_in, "**/*") if os.path.isdir(_in) else _in
files_and_directories = glob.glob(search_path, recursive=True)
uploading_files = [f for f in files_and_directories if os.path.isfile(f)]
already_uploaded = []
......@@ -53,8 +55,10 @@ def upload(_in: str, out: str, server_address: str = None, username: str = None,
for file_path in uploading_files:
relative_file_path = os.path.relpath(file_path, _in)
remote_file_path = os.path.join(out, relative_file_path)
if relative_file_path == ".":
relative_file_path = ""
remote_file_path = os.path.join(out, relative_file_path)
if remote_file_path not in already_uploaded_files:
remote_dir_path = os.path.dirname(remote_file_path)
create_remote_path_if_not_exists(remote_dir_path, nc)
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment