carnet panel2
This commit is contained in:
parent
09089090a5
commit
d19c0ef34d
@ -44,15 +44,19 @@ export async function GET(request: Request) {
|
||||
// Remove trailing slash if present
|
||||
const normalizedBaseURL = baseURL.endsWith('/') ? baseURL.slice(0, -1) : baseURL;
|
||||
|
||||
// Construct the full WebDAV URL
|
||||
const webdavURL = `${normalizedBaseURL}/remote.php/dav/files/${credentials.username}/Private`;
|
||||
console.log('WebDAV URL:', webdavURL);
|
||||
|
||||
const client = createClient({
|
||||
username: credentials.username,
|
||||
password: credentials.password,
|
||||
baseURL: normalizedBaseURL,
|
||||
baseURL: webdavURL,
|
||||
authType: 'basic',
|
||||
});
|
||||
|
||||
// Construct the folder path
|
||||
const folderPath = `remote.php/dav/files/${credentials.username}/Private/${folder}`;
|
||||
const folderPath = folder;
|
||||
console.log('Full folder path:', folderPath);
|
||||
|
||||
try {
|
||||
@ -73,10 +77,18 @@ export async function GET(request: Request) {
|
||||
return NextResponse.json(markdownFiles);
|
||||
} catch (error) {
|
||||
console.error('Error listing directory contents:', error);
|
||||
if (error instanceof Error) {
|
||||
console.error('Error details:', error.message);
|
||||
console.error('Error stack:', error.stack);
|
||||
}
|
||||
return NextResponse.json({ error: 'Failed to list directory contents' }, { status: 500 });
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Error fetching files:', error);
|
||||
if (error instanceof Error) {
|
||||
console.error('Error details:', error.message);
|
||||
console.error('Error stack:', error.stack);
|
||||
}
|
||||
return NextResponse.json({ error: 'Failed to fetch files' }, { status: 500 });
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user