Skip to content

Commit

Permalink
fix for bucket name
Browse files Browse the repository at this point in the history
  • Loading branch information
mfshao committed Jan 9, 2025
1 parent c8f584e commit 5c32e7b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions fence/blueprints/data/indexd.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ def bucket_name(self):
return self.parsed_url.netloc
return None

def bucket_config(self, input_bucket_name=""):
def bucket_config(self, bucket_name=None):
"""
Args:
bucket_name (Optional[str]): the name of the bucket, if omitted, default to use bucket_name()
Expand All @@ -994,11 +994,12 @@ def bucket_config(self, input_bucket_name=""):
"S3_BUCKETS",
InternalError("S3_BUCKETS not configured"),
)
if input_bucket_name == "":
input_bucket_name = self.bucket_name()
for bucket in s3_buckets:
if re.match("^" + bucket + "$", input_bucket_name):
return s3_buckets.get(bucket)
if not bucket_name:
bucket_name = self.bucket_name()
if bucket_name:
for bucket in s3_buckets:
if re.match("^" + bucket + "$", bucket_name):
return s3_buckets.get(bucket)
return None

def file_name(self):
Expand Down

0 comments on commit 5c32e7b

Please sign in to comment.