Skip to content

Commit 47a4b52

Browse files
committed
fix: whitespace at start of path can result in invalid restore target
1 parent 82f05d8 commit 47a4b52

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

internal/api/backresthandler.go

+3
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ func (s BackrestHandler) DoRepoTask(ctx context.Context, req *connect.Request[v1
531531
}
532532

533533
func (s *BackrestHandler) Restore(ctx context.Context, req *connect.Request[v1.RestoreSnapshotRequest]) (*connect.Response[emptypb.Empty], error) {
534+
req.Msg.Target = strings.TrimSpace(req.Msg.Target)
535+
req.Msg.Path = strings.TrimSpace(req.Msg.Path)
536+
534537
if req.Msg.Target == "" {
535538
req.Msg.Target = path.Join(os.Getenv("HOME"), "Downloads", fmt.Sprintf("restic-restore-%v", time.Now().Format("2006-01-02T15-04-05")))
536539
}

0 commit comments

Comments
 (0)