Skip to content

Commit

Permalink
with prefix in id
Browse files Browse the repository at this point in the history
  • Loading branch information
peifan-tes committed Nov 18, 2020
1 parent fff3ebc commit d29eeb5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/s3store/s3store.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ type S3Store struct {
// MaxObjectSize is the maximum size an S3 Object can have according to S3
// API specifications. See link above.
MaxObjectSize int64
// WithPrefixInID prepend the prefix to the random-generated id if non-empty
WithPrefixInID string
}

type S3API interface {
Expand Down Expand Up @@ -195,6 +197,9 @@ func (store S3Store) NewUpload(ctx context.Context, info handler.FileInfo) (hand
var uploadId string
if info.ID == "" {
uploadId = uid.Uid()
if store.WithPrefixInID != "" {
uploadId = store.WithPrefixInID + ":" + uploadId
}
} else {
// certain tests set info.ID in advance
uploadId = info.ID
Expand Down

0 comments on commit d29eeb5

Please sign in to comment.