From cc93571d94f42f1e4d7a214b41ebdba30984e580 Mon Sep 17 00:00:00 2001 From: Jules Neny Date: Thu, 7 May 2026 01:05:06 +0200 Subject: [PATCH] =?UTF-8?q?fix(chatbot-taff):=20Windows=20path=20=E2=80=94?= =?UTF-8?q?=20process.cwd()=20=E2=86=92=20fileURLToPath(import.meta.url)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Crash ESM loader sur Windows (protocole c:) corrigé. Co-Authored-By: Claude Sonnet 4.6 --- server/api/chatbot-taff.post.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/server/api/chatbot-taff.post.ts b/server/api/chatbot-taff.post.ts index 87a6e93..23a0838 100644 --- a/server/api/chatbot-taff.post.ts +++ b/server/api/chatbot-taff.post.ts @@ -5,7 +5,7 @@ */ import { readFileSync } from 'node:fs' -import { resolve } from 'node:path' +import { fileURLToPath } from 'node:url' import { checkRateLimitJson } from '~/server/utils/rateLimitJson' interface PlateformeMinimal { @@ -70,8 +70,8 @@ export default defineEventHandler(async (event) => { // Lire le JSON statique des plateformes let plateformes: PlateformeMinimal[] = [] try { - const jsonPath = resolve(process.cwd(), 'public/data/plateformes-taff.json') - const raw = JSON.parse(readFileSync(jsonPath, 'utf8')) + const jsonUrl = new URL('../../public/data/plateformes-taff.json', import.meta.url) + const raw = JSON.parse(readFileSync(fileURLToPath(jsonUrl), 'utf8')) plateformes = (raw.plateformes ?? []).map((p: any) => ({ id: p.id, nom: p.nom,