mirror of
https://github.com/Novartis/cellxgene-gateway.git
synced 2026-10-09 03:38:12 +08:00
ensure s3 bucket does not include trailing slash
This commit is contained in:
@@ -29,6 +29,8 @@ class S3ItemSource(ItemSource):
|
|||||||
):
|
):
|
||||||
self._name = name
|
self._name = name
|
||||||
self.s3 = s3fs.S3FileSystem()
|
self.s3 = s3fs.S3FileSystem()
|
||||||
|
if bucket.startswith('s3://'):
|
||||||
|
raise Exception(f"Bucket name should not include s3:// prefix, got {bucket}")
|
||||||
self.bucket = bucket
|
self.bucket = bucket
|
||||||
self.h5ad_suffix = h5ad_suffix
|
self.h5ad_suffix = h5ad_suffix
|
||||||
self.annotation_dir_suffix = annotation_dir_suffix
|
self.annotation_dir_suffix = annotation_dir_suffix
|
||||||
@@ -67,7 +69,7 @@ class S3ItemSource(ItemSource):
|
|||||||
raise Exception(f"S3 url '{url}' does not exist.")
|
raise Exception(f"S3 url '{url}' does not exist.")
|
||||||
|
|
||||||
s3key_map = dict(
|
s3key_map = dict(
|
||||||
(filepath[len(self.bucket) :], "s3://" + filepath)
|
(filepath[len(self.bucket) :].lstrip('/'), "s3://" + filepath)
|
||||||
for filepath in sorted(self.s3.ls(url))
|
for filepath in sorted(self.s3.ls(url))
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user