From 7ab0ea581d349fbfdb56d22cf9903a90efa045bb Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Wed, 1 Apr 2026 21:06:19 +0000 Subject: [PATCH] fix: strip f/ prefix from folder paths when deploying from workspace forks (#8662) * fix: strip f/ prefix from folder paths when deploying from workspace forks Co-Authored-By: Claude Opus 4.6 (1M context) * refactor: extract folderName helper for f/ prefix stripping Co-Authored-By: Claude Opus 4.6 (1M context) --------- Co-authored-by: Claude Opus 4.6 (1M context) --- .../lib/components/CompareWorkspaces.svelte | 11 ++++- frontend/src/lib/utils_workspace_deploy.ts | 44 +++++++++++++++---- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/frontend/src/lib/components/CompareWorkspaces.svelte b/frontend/src/lib/components/CompareWorkspaces.svelte index 6905ed6931..4f9184c93c 100644 --- a/frontend/src/lib/components/CompareWorkspaces.svelte +++ b/frontend/src/lib/components/CompareWorkspaces.svelte @@ -144,7 +144,7 @@ const app = await AppService.getAppByPath({ workspace, path }) return app.summary } else if (kind === 'folder') { - const folder = await FolderService.getFolder({ workspace, name: path.slice(2) }) + const folder = await FolderService.getFolder({ workspace, name: path.replace(/^f\//, '') }) return folder.summary } } catch (error) { @@ -361,7 +361,14 @@ const parent = parentWorkspaceId const current = currentWorkspaceId - for (const itemKey of selectedItems) { + const sortedItems = [...selectedItems].sort((a, b) => { + const aIsFolder = a.startsWith('folder:') + const bIsFolder = b.startsWith('folder:') + if (aIsFolder && !bIsFolder) return -1 + if (!aIsFolder && bIsFolder) return 1 + return 0 + }) + for (const itemKey of sortedItems) { const diff = selectableDiffs.find((d) => itemKey == getItemKey(d)) if (!diff) { diff --git a/frontend/src/lib/utils_workspace_deploy.ts b/frontend/src/lib/utils_workspace_deploy.ts index 200ef76373..502d0c5f0c 100644 --- a/frontend/src/lib/utils_workspace_deploy.ts +++ b/frontend/src/lib/utils_workspace_deploy.ts @@ -18,6 +18,11 @@ import { } from '$lib/utils_deployable' import type { TriggerKind } from './components/triggers' +/** Folder diff paths carry the `f/` prefix (e.g. `f/test`), but folder API endpoints expect just the name. */ +function folderName(path: string): string { + return path.replace(/^f\//, '') +} + export interface DeployItemParams { kind: Kind path: string @@ -254,12 +259,32 @@ export async function deployItem(params: DeployItemParams): Promise