W n8n attention vm
This commit is contained in:
parent
43cbd3e4bc
commit
548dc7fdcf
@ -160,12 +160,34 @@ export async function PUT(request: Request, props: { params: Promise<{ missionId
|
|||||||
volunteers
|
volunteers
|
||||||
} = body;
|
} = 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
|
// Update the mission data
|
||||||
const updatedMission = await (prisma as any).mission.update({
|
const updatedMission = await (prisma as any).mission.update({
|
||||||
where: { id: missionId },
|
where: { id: missionId },
|
||||||
data: {
|
data: {
|
||||||
name,
|
name,
|
||||||
logo,
|
logo: logoPath,
|
||||||
oddScope: oddScope || undefined,
|
oddScope: oddScope || undefined,
|
||||||
niveau,
|
niveau,
|
||||||
intention,
|
intention,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user