You've already forked docker-volume-backup
mirror of
https://github.com/offen/docker-volume-backup.git
synced 2025-11-29 05:46:50 +02:00
Paths are joined with client side separators when targeting remotes (#547)
Currently, filepath.Join is used to join path fragments that are supposed to be created on remote storage backends. This could theoretically cause problems when the separators used by the client and the remotes do not match. It's unlikely this causes problems right now, but it's definitely better to rectify it before it causes further confusion. This was raised in #541
This commit is contained in:
@@ -8,7 +8,6 @@ import (
|
||||
"io"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -115,7 +114,7 @@ func (b *sshStorage) Copy(file string) error {
|
||||
}
|
||||
defer source.Close()
|
||||
|
||||
destination, err := b.sftpClient.Create(filepath.Join(b.DestinationPath, name))
|
||||
destination, err := b.sftpClient.Create(path.Join(b.DestinationPath, name))
|
||||
if err != nil {
|
||||
return errwrap.Wrap(err, "error creating file")
|
||||
}
|
||||
@@ -180,7 +179,7 @@ func (b *sshStorage) Prune(deadline time.Time, pruningPrefix string) (*storage.P
|
||||
|
||||
pruneErr := b.DoPrune(b.Name(), len(matches), len(candidates), deadline, func() error {
|
||||
for _, match := range matches {
|
||||
if err := b.sftpClient.Remove(filepath.Join(b.DestinationPath, match)); err != nil {
|
||||
if err := b.sftpClient.Remove(path.Join(b.DestinationPath, match)); err != nil {
|
||||
return errwrap.Wrap(err, "error removing file")
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user