From 0b24d8ddaa828ce2251ab551dbff6087de615a50 Mon Sep 17 00:00:00 2001 From: "Calum H. (IMB11)" Date: Thu, 17 Sep 2026 16:16:49 +0100 Subject: [PATCH] fix(app/backend): symlinked screenshots break --- .../src/components/ui/screenshots-page/index.vue | 9 +++++++-- .../app-lib/src/api/instance/screenshots/operations.rs | 10 ++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/apps/app-frontend/src/components/ui/screenshots-page/index.vue b/apps/app-frontend/src/components/ui/screenshots-page/index.vue index 0160ddff46..2ec6de2865 100644 --- a/apps/app-frontend/src/components/ui/screenshots-page/index.vue +++ b/apps/app-frontend/src/components/ui/screenshots-page/index.vue @@ -344,10 +344,15 @@ const screenshotOptionsInstance = computed(() => ), ) const screenshotsError = computed(() => { - const error = + const error: unknown = screenshotsQuery.error.value || (groupBy.value === 'custom' ? screenshotGroupsQuery.error.value : null) - return error instanceof Error ? error : error ? new Error(String(error)) : null + if (!error) return null + if (error instanceof Error) return error + if (typeof error === 'object' && 'message' in error && typeof error.message === 'string') { + return new Error(error.message) + } + return new Error(String(error)) }) const selectionActive = computed(() => selectedKeys.value.size > 0) const selectedScreenshots = computed(() => diff --git a/packages/app-lib/src/api/instance/screenshots/operations.rs b/packages/app-lib/src/api/instance/screenshots/operations.rs index a0587acf21..6293564176 100644 --- a/packages/app-lib/src/api/instance/screenshots/operations.rs +++ b/packages/app-lib/src/api/instance/screenshots/operations.rs @@ -520,6 +520,16 @@ pub(super) async fn source_screenshots_dir( .await .map_err(|error| IOError::with_path(error, &instance_dir))?; let screenshots_dir = canonical_instance_dir.join(SCREENSHOTS_DIRECTORY); + let screenshots_dir = match tokio::fs::canonicalize(&screenshots_dir).await + { + Ok(path) => path, + Err(error) if error.kind() == std::io::ErrorKind::NotFound => { + screenshots_dir + } + Err(error) => { + return Err(IOError::with_path(error, &screenshots_dir).into()); + } + }; ensure_directory_is_not_symlink(&screenshots_dir).await?; Ok(screenshots_dir)