diff --git a/internal/provider/S3Provider.go b/internal/provider/S3Provider.go index 0dcdb6eff..414d03a8d 100644 --- a/internal/provider/S3Provider.go +++ b/internal/provider/S3Provider.go @@ -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 { @@ -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) }