Skip to content

Commit d12fab5

Browse files
committed
Bugfix for handling relative_links in the upload directory.
1 parent 1a4f75d commit d12fab5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Enable setting/getting of asset-level permissions in `set_permissions()` and `fetch_permissions()`.
66
- Added the `force=` option to forcibly remove directories in `remove_asset()`, `remove_version()` and `reject_probation()`.
7+
- Bugfix for handling relative links in `upload_directory()`.
78

89
## Version 0.1.2
910

src/pygobbler/upload_directory.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ def upload_directory(project: str, asset: str, version: str, directory: str, sta
5050

5151
if slink == "":
5252
_link_or_copy(src, dest)
53-
elif _is_absolute_or_local_link(slink, f):
53+
elif _is_absolute_or_local_link(slink, rel):
5454
os.symlink(slink, dest)
5555
else:
5656
full_src = os.path.normpath(os.path.join(os.path.dirname(src), slink))
@@ -76,7 +76,7 @@ def _is_absolute_or_local_link(target: str, link_path: str) -> bool:
7676
# Both 'target' and 'link_path' should be relative at this point, so the
7777
# idea is to check whether 'os.path.join(os.path.dirname(link_path),
7878
# target)' is still a child of 'os.path.dirname(link_path)'.
79-
pre_length = len(link_path.split("/"))
79+
pre_length = len(link_path.split("/")) - 1
8080
post_fragments = target.split("/")[:-1]
8181

8282
for x in post_fragments:

0 commit comments

Comments
 (0)