From 3a3c87164dc9610438d8c67f06f677496f49d439 Mon Sep 17 00:00:00 2001 From: eshmeshek Date: Mon, 2 Mar 2026 02:25:11 +0300 Subject: [PATCH] Fix export endpoint error with Cyrillic filenames Content-Disposition header cannot contain non-ASCII characters. Use RFC 5987 encoding (filename*=UTF-8'') for proper Cyrillic filename support, with ASCII-only fallback in the base filename. Co-Authored-By: Claude Opus 4.6 --- backend/src/controllers/endpointController.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/src/controllers/endpointController.ts b/backend/src/controllers/endpointController.ts index 0ce6825..dbdc0ea 100644 --- a/backend/src/controllers/endpointController.ts +++ b/backend/src/controllers/endpointController.ts @@ -492,9 +492,10 @@ export const exportEndpoint = async (req: AuthRequest, res: Response) => { const encrypted = encryptEndpointData(exportData); - const safeFileName = endpoint.name.replace(/[^a-zA-Z0-9_\-а-яА-ЯёЁ]/g, '_'); + const safeFileName = endpoint.name.replace(/[^a-zA-Z0-9_\-]/g, '_'); + const encodedFileName = encodeURIComponent(endpoint.name.replace(/[\/\\:*?"<>|]/g, '_')) + '.kabe'; res.setHeader('Content-Type', 'application/octet-stream'); - res.setHeader('Content-Disposition', `attachment; filename="${safeFileName}.kabe"`); + res.setHeader('Content-Disposition', `attachment; filename="${safeFileName}.kabe"; filename*=UTF-8''${encodedFileName}`); res.send(encrypted); } catch (error) { console.error('Export endpoint error:', error);