Skip to content

Commit a4214e3

Browse files
committed
fix base name
Signed-off-by: Romeo Kienzler <romeo.kienzler1@ibm.com>
1 parent 793f6fb commit a4214e3

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

src/claimed/components/util/cosutils.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@
3131

3232
def _upload(s3, local_file, cos_file):
3333
"""Upload a single file to S3/COS with a byte-level progress bar."""
34+
# If cos_file is a bucket root or ends with '/', treat it as a directory prefix
35+
if cos_file == '' or cos_file.endswith('/') or '/' not in cos_file:
36+
cos_file = cos_file.rstrip('/') + '/' + os.path.basename(local_file)
3437
size = os.path.getsize(local_file)
3538
desc = os.path.basename(local_file)
3639
with tqdm(total=size, unit='B', unit_scale=True, unit_divisor=1024,

0 commit comments

Comments
 (0)