Skip to content

Commit

Permalink
Merge pull request #697 from RockefellerArchiveCenter/development
Browse files Browse the repository at this point in the history
Truncate S3 bucket name
  • Loading branch information
helrond authored Dec 5, 2024
2 parents 73ca802 + c91d631 commit 81128d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bag_transfer/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ def admin_users(self):
@property
def upload_target(self):
if settings.S3_USE:
return f"{settings.S3_PREFIX}-{self.machine_name}-upload"
max_len = 63 - len(settings.S3_PREFIX) - 8 # ensure bucket name will not exceed max length
machine_name_truncated = self.machine_name[:max_len]
return f"{settings.S3_PREFIX}-{machine_name_truncated}-upload"
else:
return join(settings.TRANSFER_UPLOADS_ROOT.rstrip("/"), self.machine_name, "upload")

Expand Down

0 comments on commit 81128d5

Please sign in to comment.