diff --git a/lib/strapi/search.ts b/lib/strapi/search.ts index 6587ca0..a685686 100644 --- a/lib/strapi/search.ts +++ b/lib/strapi/search.ts @@ -69,12 +69,14 @@ export const getDriveDirectories = async (): Promise => { try { const session = await getServerSession(authOptions) - const drive = session && session.user ? privateDrive : publicDrive + if (!session?.user) { + return null + } - if (!drive) { + if (!privateDrive) { throw new Error('Drive instance is not available') } - return drive.getAllDirectories() + return privateDrive.getAllDirectories() } catch (err) { console.error('Error searching files:', err) return null