Skip to content

Commit

Permalink
Fix Backup Storage Error in Uploader (#550)
Browse files Browse the repository at this point in the history
At uploader.go -> `Upload()` method in `remoteUploader`:

This commit creates the parent directory for `storageFilePath`
within the backup_storage directory before moving it.

This ensures that the necessary directory structure
exists, preventing backup failures that occur when
the parent directory of `storageFilePath` is missing.
  • Loading branch information
cruizba authored Dec 4, 2023
1 parent d157525 commit b7bb753
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/pipeline/sink/uploader/uploader.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,12 @@ func (u *remoteUploader) Upload(localFilepath, storageFilepath string, outputTyp
return "", 0, err
}

backupFilepath := path.Join(u.backup, storageFilepath)
backupDir := path.Join(u.backup, path.Dir(storageFilepath))
backupFileName := path.Base(storageFilepath)
if err = os.MkdirAll(backupDir, 0755); err != nil {
return "", 0, err
}
backupFilepath := path.Join(backupDir, backupFileName)
if err = os.Rename(localFilepath, backupFilepath); err != nil {
return "", 0, err
}
Expand Down

0 comments on commit b7bb753

Please sign in to comment.