This commit is contained in:
Timothy Jaeryang Baek
2026-03-02 12:07:55 -06:00
parent 72951324df
commit 395098c6f1
2 changed files with 6 additions and 0 deletions
+4
View File
@@ -334,6 +334,10 @@
if (source === destination) return;
// Prevent moving a folder into itself or its own subtree
const sourceDir = source.endsWith('/') ? source : source + '/';
if (destFolder.startsWith(sourceDir)) return;
const result = await moveEntry(terminal.url, terminal.key, source, destination);
toast[result ? 'success' : 'error'](
$i18n.t(result ? 'Moved {{name}}' : 'Failed to move {{name}}', { name: fileName })
@@ -51,6 +51,8 @@
const data = JSON.parse(raw);
if (data.path) {
const destFolder = `${currentPath}${entry.name}/`;
// Don't allow dropping a folder onto itself
if (data.path + '/' === destFolder || data.path === destFolder) return;
onMove(data.path, destFolder);
}
} catch {}