Skip to content

Commit

Permalink
Merge pull request #3 from isd-sgcu/gear-be/fdr-57-be-store-fix-file-…
Browse files Browse the repository at this point in the history
…extension

fix: file extension
  • Loading branch information
bookpanda authored Jun 30, 2024
2 parents d2a4166 + 31060d1 commit a61cc94
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/object/object.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ package object
import (
"context"
"fmt"
"path/filepath"
"strings"

proto "github.com/isd-sgcu/rpkm67-go-proto/rpkm67/store/object/v1"
"github.com/isd-sgcu/rpkm67-store/config"
Expand Down Expand Up @@ -41,7 +43,9 @@ func (s *serviceImpl) Upload(_ context.Context, req *proto.UploadObjectRequest)
return nil, status.Error(codes.Internal, constant.InternalServerErrorMessage)
}

objectKey := req.Filename + "_" + randomString
ext := filepath.Ext(req.Filename)
filename := strings.TrimSuffix(req.Filename, ext)
objectKey := filename + "_" + randomString + ext

url, key, err := s.repo.Upload(req.Data, s.conf.BucketName, objectKey)
if err != nil {
Expand Down

0 comments on commit a61cc94

Please sign in to comment.