Skip to content

Commit

Permalink
fix: use netappKey when downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
Artonus committed Feb 27, 2024
1 parent efbb407 commit e1d9c03
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions internal/data-service/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,7 @@ func (s3Service *S3Service) Fetch(netAppKey, targetDir string) error {

for _, obj := range resp.Contents {
// Specify the local file path to save the object
pwd, pwdErr := os.Getwd()
if pwdErr != nil {
return pwdErr
}
localFilePath := filepath.Join(pwd, targetDir, *obj.Key)
localFilePath := filepath.Join(targetDir, netAppKey, *obj.Key)
errCreateDir := util.EnsurePathToFileExists(localFilePath)
if errCreateDir != nil {
return errCreateDir
Expand Down Expand Up @@ -90,7 +86,7 @@ func (s3Service *S3Service) Post(netAppKey, sourceDir string) error {
}

for _, file := range files {
filePath := filepath.Join(sourceDir, file.Name())
filePath := filepath.Join(sourceDir, netAppKey, file.Name())
fileData, openFileErr := os.Open(filePath)
if openFileErr != nil {
return openFileErr
Expand Down

0 comments on commit e1d9c03

Please sign in to comment.