carnet panel contact

This commit is contained in:
alma 2025-04-20 20:49:08 +02:00
parent a7d9a6d7e9
commit dca1d5f204

View File

@ -145,8 +145,9 @@ export async function PUT(request: Request) {
const { client, username } = await createWebDAVClient(session.user.id);
try {
const path = `/files/${username}/Private/${folder}/${title}.md`;
console.log('Updating note at path:', path);
// Use the title as is, since it should already include the extension
const path = `/files/${username}/Private/${folder}/${title}`;
console.log('Updating file at path:', path);
await client.putFileContents(path, content);
@ -155,7 +156,7 @@ export async function PUT(request: Request) {
return NextResponse.json({
id: fileDetails.filename,
title: fileDetails.basename.replace('.md', ''),
title: fileDetails.basename,
lastModified: new Date(fileDetails.lastmod).toISOString(),
size: fileDetails.size,
type: 'file',
@ -163,8 +164,8 @@ export async function PUT(request: Request) {
etag: fileDetails.etag
});
} catch (error) {
console.error('Error updating note:', error);
return NextResponse.json({ error: 'Failed to update note' }, { status: 500 });
console.error('Error updating file:', error);
return NextResponse.json({ error: 'Failed to update file' }, { status: 500 });
}
} catch (error) {
console.error('Error in PUT request:', error);