carnet panel contact
This commit is contained in:
parent
05cff9a97c
commit
0d8a099aef
@ -137,7 +137,7 @@ export async function PUT(request: Request) {
|
|||||||
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
return NextResponse.json({ error: 'Unauthorized' }, { status: 401 });
|
||||||
}
|
}
|
||||||
|
|
||||||
const { id, title, content, folder } = await request.json();
|
const { id, title, content, folder, mime } = await request.json();
|
||||||
if (!id || !title || !content || !folder) {
|
if (!id || !title || !content || !folder) {
|
||||||
return NextResponse.json({ error: 'Missing required fields' }, { status: 400 });
|
return NextResponse.json({ error: 'Missing required fields' }, { status: 400 });
|
||||||
}
|
}
|
||||||
@ -145,12 +145,12 @@ export async function PUT(request: Request) {
|
|||||||
const { client, username } = await createWebDAVClient(session.user.id);
|
const { client, username } = await createWebDAVClient(session.user.id);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Use the title as is, since it should already include the extension
|
// Use the provided path directly
|
||||||
const path = `/files/${username}/Private/${folder}/${title}`;
|
const path = id;
|
||||||
console.log('Updating file at path:', path);
|
console.log('Updating file at path:', path);
|
||||||
|
|
||||||
// Set the correct content type based on file extension
|
// Set the correct content type based on file extension or provided mime type
|
||||||
const contentType = title.endsWith('.vcf') ? 'text/vcard' : 'text/markdown';
|
const contentType = mime || (title.endsWith('.vcf') ? 'text/vcard' : 'text/markdown');
|
||||||
await client.putFileContents(path, content, { contentType });
|
await client.putFileContents(path, content, { contentType });
|
||||||
|
|
||||||
// Get the updated file details
|
// Get the updated file details
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user