Skip to content

Commit 4621882

Browse files
authored
fix path mismatch issue, always expand path (#2527)
1 parent 58392f7 commit 4621882

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

pkg/wshrpc/wshserver/wshserver.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -442,7 +442,15 @@ func (ws *WshServer) FileShareCapabilityCommand(ctx context.Context, path string
442442
}
443443

444444
func (ws *WshServer) FileRestoreBackupCommand(ctx context.Context, data wshrpc.CommandFileRestoreBackupData) error {
445-
return filebackup.RestoreBackup(data.BackupFilePath, data.RestoreToFileName)
445+
expandedBackupPath, err := wavebase.ExpandHomeDir(data.BackupFilePath)
446+
if err != nil {
447+
return fmt.Errorf("failed to expand backup file path: %w", err)
448+
}
449+
expandedRestorePath, err := wavebase.ExpandHomeDir(data.RestoreToFileName)
450+
if err != nil {
451+
return fmt.Errorf("failed to expand restore file path: %w", err)
452+
}
453+
return filebackup.RestoreBackup(expandedBackupPath, expandedRestorePath)
446454
}
447455

448456
func (ws *WshServer) DeleteSubBlockCommand(ctx context.Context, data wshrpc.CommandDeleteBlockData) error {

0 commit comments

Comments
 (0)