Skip to content

Commit 1a9ecc5

Browse files
fix: restore path on Windows (#631)
Co-authored-by: Gareth George <garethgeorge97@gmail.com>
1 parent f119e1e commit 1a9ecc5

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

internal/orchestrator/repo/repo.go

+11-12
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"io"
88
"path"
9-
"runtime"
109
"slices"
1110
"sort"
1211
"strings"
@@ -311,17 +310,17 @@ func (r *RepoOrchestrator) Restore(ctx context.Context, snapshotId string, snaps
311310
opts = append(opts, restic.WithFlags("--target", target))
312311

313312
if snapshotPath != "" {
314-
if runtime.GOOS == "windows" {
315-
opts = append(opts, restic.WithFlags("--include", snapshotPath))
316-
} else {
317-
dir := path.Dir(snapshotPath)
318-
base := path.Base(snapshotPath)
319-
if dir != "" {
320-
snapshotId = snapshotId + ":" + dir
321-
}
322-
if base != "" {
323-
opts = append(opts, restic.WithFlags("--include", base))
324-
}
313+
normalizedPath := strings.ReplaceAll(snapshotPath, "\\", "/")
314+
315+
dir := path.Dir(normalizedPath)
316+
base := path.Base(normalizedPath)
317+
318+
319+
if dir != "" {
320+
snapshotId = snapshotId + ":" + dir
321+
}
322+
if base != "" {
323+
opts = append(opts, restic.WithFlags("--include", base))
325324
}
326325
}
327326

0 commit comments

Comments
 (0)