From 4a96441437f7855cbce0bda617250ccd175fa430 Mon Sep 17 00:00:00 2001 From: skjnldsv Date: Fri, 21 Feb 2025 10:18:47 +0100 Subject: fix(files): handle failed node properly Signed-off-by: skjnldsv --- apps/files/src/components/FileEntryMixin.ts | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) (limited to 'apps/files/src') diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index d949a907d43..ece4f4ce225 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -133,11 +133,16 @@ export default defineComponent({ return this.source.status === NodeStatus.FAILED }, - canDrag() { + canDrag(): boolean { if (this.isRenaming) { return false } + // Ignore if the node is not available + if (this.isFailedSource) { + return false + } + const canDrag = (node: Node): boolean => { return (node?.permissions & Permission.UPDATE) !== 0 } @@ -150,11 +155,16 @@ export default defineComponent({ return canDrag(this.source) }, - canDrop() { + canDrop(): boolean { if (this.source.type !== FileType.Folder) { return false } + // Ignore if the node is not available + if (this.isFailedSource) { + return false + } + // If the current folder is also being dragged, we can't drop it on itself if (this.draggingFiles.includes(this.source.source)) { return false @@ -274,6 +284,11 @@ export default defineComponent({ return } + // Ignore right click if the node is not available + if (this.isFailedSource) { + return + } + // The grid mode is compact enough to not care about // the actions menu mouse position if (!this.gridMode) { @@ -311,6 +326,11 @@ export default defineComponent({ return } + // Ignore if the node is not available + if (this.isFailedSource) { + return + } + // if ctrl+click / cmd+click (MacOS uses the meta key) or middle mouse button (button & 4), open in new tab // also if there is no default action use this as a fallback const metaKeyPressed = event.ctrlKey || event.metaKey || Boolean(event.button & 4) -- cgit v1.2.3