Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kyeah committed Jun 24, 2024
1 parent 5eb5b42 commit ab3e425
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions bcda/lambda/cclf/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ func cclfImportHandler(ctx context.Context, sqsEvent events.SQSEvent) (string, e
return "", err
}

parts := strings.SplitN(e.S3.Object.Key, "/", 2)
lastSeparatorIdx := strings.LastIndex(e.S3.Object.Key, "/")

if len(parts) == 1 {
if lastSeparatorIdx == -1 {
return handleCclfImport(s3AssumeRoleArn, e.S3.Bucket.Name)
} else {
directory := fmt.Sprintf("%s/%s", e.S3.Bucket.Name, parts[0])
directory := fmt.Sprintf("%s/%s", e.S3.Bucket.Name, e.S3.Object.Key[:lastSeparatorIdx-1])
return handleCclfImport(s3AssumeRoleArn, directory)
}
}
Expand Down
6 changes: 3 additions & 3 deletions bcda/lambda/optout/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ func optOutImportHandler(ctx context.Context, sqsEvent events.SQSEvent) (string,
return "", err
}

parts := strings.SplitN(e.S3.Object.Key, "/", 2)
lastSeparatorIdx := strings.LastIndex(e.S3.Object.Key, "/")

if len(parts) == 1 {
if lastSeparatorIdx == -1 {
return handleOptOutImport(s3AssumeRoleArn, e.S3.Bucket.Name)
} else {
directory := fmt.Sprintf("%s/%s", e.S3.Bucket.Name, parts[0])
directory := fmt.Sprintf("%s/%s", e.S3.Bucket.Name, e.S3.Object.Key[:lastSeparatorIdx-1])
return handleOptOutImport(s3AssumeRoleArn, directory)
}
}
Expand Down

0 comments on commit ab3e425

Please sign in to comment.