From 7d43e669a8f85f7c0e247fdee703680c93a807ce Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sat, 10 Jan 2026 08:51:14 +0800 Subject: [PATCH] fix(analyze): improve deletion safety and UI clarity - Update UI status to 'Moving to Trash...' for clarity - Use os.Lstat instead of os.Stat to correctly handle broken symlinks during deletion checks --- cmd/analyze/delete.go | 4 ++-- cmd/analyze/main.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/analyze/delete.go b/cmd/analyze/delete.go index 04a7fa2..11feaee 100644 --- a/cmd/analyze/delete.go +++ b/cmd/analyze/delete.go @@ -80,8 +80,8 @@ func (e *multiDeleteError) Error() string { // trashPathWithProgress moves a path to Trash using Finder. // This allows users to recover accidentally deleted files. func trashPathWithProgress(root string, counter *int64) (int64, error) { - // Verify path exists. - info, err := os.Stat(root) + // Verify path exists (use Lstat to handle broken symlinks). + info, err := os.Lstat(root) if err != nil { return 0, err } diff --git a/cmd/analyze/main.go b/cmd/analyze/main.go index 712d70b..f34464a 100644 --- a/cmd/analyze/main.go +++ b/cmd/analyze/main.go @@ -515,7 +515,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { if m.deleting && m.deleteCount != nil { count := atomic.LoadInt64(m.deleteCount) if count > 0 { - m.status = fmt.Sprintf("Deleting... %s items removed", formatNumber(count)) + m.status = fmt.Sprintf("Moving to Trash... %s items", formatNumber(count)) } } return m, tickCmd()