Skip to content

Commit

Permalink
SRVKP-6439 : FixLint
Browse files Browse the repository at this point in the history
  • Loading branch information
pramodbindal committed Sep 25, 2024
1 parent 2c7d343 commit 1648719
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/provider/S3Provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ func getS3Client(ctx context.Context) *s3.Client {

func (S3Provider) download(ctx context.Context, source, filePath string) error {
s3Client := getS3Client(ctx)
index := strings.Index(source, "//")
index := strings.Index(source, "/")
if index == -1 {
return fmt.Errorf("invalid S3 URL: %s", source)
}
bucket := source[:index]
key := source[index:]
key := source[index+1:]
log.Printf("Downloading from S3. FIle: %s, Bucket: %s Key : %s", filePath, bucket, key)

if err := os.MkdirAll(filepath.Dir(filePath), os.ModePerm); err != nil {
Expand Down Expand Up @@ -90,7 +90,7 @@ func (S3Provider) download(ctx context.Context, source, filePath string) error {

func (S3Provider) upload(ctx context.Context, target, filePath string) error {
// Upload the file
index := strings.Index(target, "//")
index := strings.Index(target, "/")
if index == -1 {
return fmt.Errorf("invalid S3 URL: %s", target)
}
Expand Down

0 comments on commit 1648719

Please sign in to comment.