W n8n attention vm

This commit is contained in:
alma 2025-05-24 12:52:35 +02:00
parent 43cbd3e4bc
commit 548dc7fdcf

View File

@ -160,12 +160,34 @@ export async function PUT(request: Request, props: { params: Promise<{ missionId
volunteers
} = body;
// Process logo URL to get relative path
let logoPath = logo;
if (logo && typeof logo === 'string') {
try {
// If it's a full URL, extract the path
if (logo.startsWith('http')) {
const url = new URL(logo);
logoPath = url.pathname.startsWith('/') ? url.pathname.substring(1) : url.pathname;
}
// If it's already a relative path, ensure it starts with 'missions/'
else if (!logo.startsWith('missions/')) {
logoPath = `missions/${logo}`;
}
} catch (error) {
console.error('Error processing logo URL:', {
error,
logo,
missionId
});
}
}
// Update the mission data
const updatedMission = await (prisma as any).mission.update({
where: { id: missionId },
data: {
name,
logo,
logo: logoPath,
oddScope: oddScope || undefined,
niveau,
intention,