Skip to content

Commit 44dd505

Browse files
committed
fix: adjust landing page logic
this change addresses two problems: - ensure that the userID searched for in s3 have a underscore and not a "@" symbol - corrects the landing page destination for the metadata bucket so it alights with previous landing pages structure
1 parent ff8994e commit 44dd505

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

helpers/helpers.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type TemplateData struct {
3636
MailUploaderName string
3737
MailUploaderOrganizationName string
3838
MailUploader string
39-
MailSecretName string
39+
MailSecretName string
4040
MailSMTPHost string
4141
MailSMTPPort string
4242
CertSecretName string

internal/landingpage/landingpage.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ func Run(cfg *config.Config) error {
5757
return err
5858
}
5959

60-
prefix := fmt.Sprintf("%s/%s", cfg.UserID, cfg.DatasetFolder)
60+
bucketUserID := strings.ReplaceAll(cfg.UserID, "@", "_")
61+
prefix := fmt.Sprintf("%s/%s", bucketUserID, cfg.DatasetFolder)
6162
slog.Info("listing landing pages", "source_bucket", archiveBucket, "prefix", prefix)
6263
objects, err := archiveStorage.ListObjects(archiveBucket, prefix)
6364
if err != nil {
@@ -69,7 +70,7 @@ func Run(cfg *config.Config) error {
6970
}
7071

7172
for _, object := range objects {
72-
objectLocation := strings.ReplaceAll(fmt.Sprintf("%s/%s", "datasets", object.Key), fmt.Sprintf("/%s", cfg.DatasetFolder), "")
73+
objectLocation := strings.ReplaceAll(fmt.Sprintf("%s/%s/%s", "datasets", cfg.DatasetID, object.Key), fmt.Sprintf("/%s", bucketUserID), "")
7374
slog.Info("uploading", "destination_bucket", metadataBucket, "object_location", objectLocation)
7475
reader, err := archiveStorage.GetObject(archiveBucket, object.Key)
7576
if err != nil {
@@ -82,5 +83,4 @@ func Run(cfg *config.Config) error {
8283
}
8384
}
8485
return nil
85-
8686
}

0 commit comments

Comments
 (0)