fix: resolve 404 file not found when permanently deleting files already in trash
All checks were successful
Automated Container Build / build-and-push (push) Successful in 1m20s

This commit is contained in:
Elijah 2026-05-23 14:38:09 -07:00
parent 1a1add48bf
commit 2596382ea8
2 changed files with 22 additions and 16 deletions

View file

@ -632,17 +632,22 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
async function executeDeleteSelected() {
const count = selectedFiles.size;
const isPermanent = activeSection === 'trash';
for (const path of selectedFiles) {
await api.deleteFile(path, isPermanent);
try {
for (const path of selectedFiles) {
await api.deleteFile(path, isPermanent);
}
setSelectedFiles(new Set());
if (activeSection === 'trash') {
loadTrash();
} else {
loadFiles(undefined, true);
}
showToast(isPermanent ? `Permanently deleted ${count} item${count > 1 ? 's' : ''}` : `Deleted ${count} item${count > 1 ? 's' : ''}`);
} catch (err: any) {
showToast(`Delete failed: ${err.message}`);
} finally {
setDeleteConfirm(null);
}
setSelectedFiles(new Set());
if (activeSection === 'trash') {
loadTrash();
} else {
loadFiles(undefined, true);
}
setDeleteConfirm(null);
showToast(isPermanent ? `Permanently deleted ${count} item${count > 1 ? 's' : ''}` : `Deleted ${count} item${count > 1 ? 's' : ''}`);
}
async function executeDeleteSingle(file: FileItem) {
@ -654,10 +659,11 @@ export default function FileExplorer({ onLogout }: FileExplorerProps) {
} else {
loadFiles(undefined, true);
}
setDeleteConfirm(null);
showToast(isPermanent ? `Permanently deleted ${file.name}` : `Deleted ${file.name}`);
} catch (err: any) {
showToast(`Delete failed: ${err.message}`);
} finally {
setDeleteConfirm(null);
}
}