From b5aefcf3a83d9b5fac411bbe34f2281f0aeabe56 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Thu, 19 Feb 2026 20:06:04 +0545 Subject: [PATCH 1/3] fix(OUT-3164): prevent file sync from assembly to dbx when connection is false --- src/features/webhook/assembly/api/webhook.controller.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/features/webhook/assembly/api/webhook.controller.ts b/src/features/webhook/assembly/api/webhook.controller.ts index 5619d55..09c0c19 100644 --- a/src/features/webhook/assembly/api/webhook.controller.ts +++ b/src/features/webhook/assembly/api/webhook.controller.ts @@ -19,6 +19,11 @@ export const handleWebhookEvent = async (req: NextRequest) => { const dropboxConnectionService = new DropboxConnectionsService(user) const connection = await dropboxConnectionService.getConnectionForWorkspace() + if (!connection.status) { + console.info(`Sync is not enabled for this workspace. Skipping webhook event`) + return NextResponse.json({}) + } + if (!connection.refreshToken) throw new APIError('No refresh token found', httpStatus.NOT_FOUND) if (!connection.accountId) throw new APIError('No accountId found', httpStatus.NOT_FOUND) From 50cd98ab22992b9dfee92357eeb892e565a39379 Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Thu, 19 Feb 2026 20:51:17 +0545 Subject: [PATCH 2/3] fix(OUT-3164): update filename sanitization process --- src/utils/filePath.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/utils/filePath.ts b/src/utils/filePath.ts index 211cc1b..95093f8 100644 --- a/src/utils/filePath.ts +++ b/src/utils/filePath.ts @@ -82,6 +82,15 @@ export function sanitizePath(path: string) { } export function sanitizeFileNameForAssembly(filename: string): string { + return unorm + .nfd(filename) // decompose accents + .replace(/[\u0300-\u036f]/g, '') // remove diacritics + .replace(/[^a-zA-Z0-9._/() -]/g, '_') // replace special chars with _ + .replace(/_+/g, '_') // collapse multiple _ + .replace(/^_+|_+$/g, '') // trim _ from ends +} + +export function getFaultyPath(filename: string): string { return unorm .nfd(filename) // decompose accents .replace(/[\u0300-\u036f]/g, '') // remove diacritics From 18d9b4aab4c63665c64b0fe8ac4f71216228250a Mon Sep 17 00:00:00 2001 From: SandipBajracharya Date: Fri, 20 Feb 2026 17:36:59 +0545 Subject: [PATCH 3/3] docs(OUT-3164): log the sanitized path --- src/lib/copilot/CopilotAPI.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/lib/copilot/CopilotAPI.ts b/src/lib/copilot/CopilotAPI.ts index ac51919..24f1661 100644 --- a/src/lib/copilot/CopilotAPI.ts +++ b/src/lib/copilot/CopilotAPI.ts @@ -23,7 +23,7 @@ import { CopilotFileCreateSchema, type CopilotFileList, CopilotFileListSchema, - CopilotFileRetrieve, + type CopilotFileRetrieve, CopilotFileRetrieveSchema, type CopilotListArgs, type CopilotPrice, @@ -191,10 +191,13 @@ export class CopilotAPI { channelId: string, fileType: ObjectTypeValue, ): Promise { + const saniztedPath = sanitizeFileNameForAssembly(path) + console.info(`CopilotAPI#_createFile. Path: ${saniztedPath}`) + const createFileResponse = await this.copilot.createFile({ fileType, requestBody: { - path: sanitizeFileNameForAssembly(path), + path: saniztedPath, channelId, }, }) @@ -220,8 +223,16 @@ export class CopilotAPI { return await this.copilot.deleteFile({ id }) } - async _listFiles(channelId: string, nextToken?: string): Promise { - const list = await this.copilot.listFiles({ channelId, nextToken, limit: MAX_FILES_LIMIT }) + async _listFiles( + channelId: string, + nextToken?: string, + customLimit?: number, + ): Promise { + const list = await this.copilot.listFiles({ + channelId, + nextToken, + limit: customLimit || MAX_FILES_LIMIT, + }) return CopilotFileListSchema.parse(list) }