Skip to content

Commit 3b0f64d

Browse files
committed
Trying to fix again
1 parent 19ed416 commit 3b0f64d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

__main__.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,18 +66,21 @@ def push():
6666
remote_path = repo_config["path"]
6767

6868
def ensure_remote_directory(remote_dir):
69-
# Remove trailing slash (if any) and split the path
70-
remote_dir = remote_dir.rstrip('/')
69+
# Always ensure the remote directory path ends with a slash
70+
if not remote_dir.endswith('/'):
71+
remote_dir += '/'
7172
parts = remote_dir.split('/')
7273
current = ""
7374
for part in parts:
74-
if part: # skip empty parts from leading /
75+
if part: # skip empty parts from leading '/'
7576
current += "/" + part
76-
if not client.is_dir(current):
77+
# Always check with trailing slash so that it is recognized as a directory.
78+
current_slash = current + "/"
79+
if not client.is_dir(current_slash):
7780
try:
78-
client.mkdir(current)
81+
client.mkdir(current_slash)
7982
except Exception as e:
80-
click.echo(click.style(f"Error creating directory {current}: {e}", fg="red"))
83+
click.echo(click.style(f"Error creating directory {current_slash}: {e}", fg="red"))
8184

8285
for root, _, files in os.walk(copy_dir):
8386
for file in files:

0 commit comments

Comments
 (0)