Skip to content

Commit a2ee135

Browse files
committed
Fix problematic tar entries for TS upload.
1 parent fe93aba commit a2ee135

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

planemo/shed.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,12 @@ def build_tarball(realized_path, **kwds):
401401
try:
402402
tar = tarfile.open(temp_path, "w:gz", dereference=True)
403403
try:
404-
tar.add(realized_path, arcname=".", recursive=True)
404+
for name in os.listdir(realized_path):
405+
tar.add(
406+
os.path.join(realized_path, name),
407+
arcname=name,
408+
recursive=True,
409+
)
405410
finally:
406411
tar.close()
407412
finally:

tests/test_shed_upload.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,12 @@ def _untar(self, f, path):
235235
tar = tarfile.open(path, "r:gz")
236236
tar.extractall(path=target)
237237
tar.close()
238+
tar = tarfile.open(path, "r:gz")
239+
for tar_info in tar.getmembers():
240+
# These entries cause problems with TS.
241+
assert tar_info.name != "."
242+
assert tar_info.name != ""
243+
tar.close()
238244
return target
239245

240246

0 commit comments

Comments
 (0)