diff --git a/app/src/pages/api/item.ts b/app/src/pages/api/item.ts index 5d8a183..d54b24d 100644 --- a/app/src/pages/api/item.ts +++ b/app/src/pages/api/item.ts @@ -97,7 +97,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) try { queryId = decryptData(id); // console.log(queryId); - assert(queryId.match(/^[A-Za-z0-9]+$/)) + assert(queryId.match(/^[A-Za-z0-9!]+$/)) } catch (err) { res.status(400).json({error: 'Invalid driveItem ID.'}) return; diff --git a/app/src/pages/api/search.ts b/app/src/pages/api/search.ts index d8d9f4a..3a6d378 100644 --- a/app/src/pages/api/search.ts +++ b/app/src/pages/api/search.ts @@ -62,6 +62,7 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse) delete item?.parentReference?.driveId delete item?.parentReference?.driveType delete item?.parentReference?.siteId + delete item?.parentReference?.path item.id = encryptData(item.id); if (item.parentReference.id) { item.parentReference.id = encryptData(item?.parentReference?.id) diff --git a/app/src/pages/setup/step-1.tsx b/app/src/pages/setup/step-1.tsx index 318c52b..e6e13e1 100644 --- a/app/src/pages/setup/step-1.tsx +++ b/app/src/pages/setup/step-1.tsx @@ -50,7 +50,8 @@ export default function OAuthStep1({ installed, apiConfig, build_id }) { const router = useRouter() if (installed) { router.query.path = router.pathname.substring(1).split('/') - return Folders(build_id) + //@ts-ignore + return Folders({ build_id }) } return ( diff --git a/app/src/pages/setup/step-2.tsx b/app/src/pages/setup/step-2.tsx index 10d4a82..348580e 100644 --- a/app/src/pages/setup/step-2.tsx +++ b/app/src/pages/setup/step-2.tsx @@ -51,7 +51,8 @@ export default function OAuthStep2({ installed, redirectUri, oAuthUrl, build_id if (installed) { router.query.path = router.pathname.substring(1).split('/') - return Folders(build_id) + //@ts-ignore + return Folders({ build_id }) } return ( diff --git a/app/src/pages/setup/step-3.tsx b/app/src/pages/setup/step-3.tsx index b4c337a..ba72273 100644 --- a/app/src/pages/setup/step-3.tsx +++ b/app/src/pages/setup/step-3.tsx @@ -74,7 +74,8 @@ export default function OAuthStep3({ accessToken, expiryTime, refreshToken, erro if (installed) { router.query.path = router.pathname.substring(1).split('/') - return Folders(build_id) + //@ts-ignore + return Folders({ build_id }) } const sendAuthTokensToServer = async () => { diff --git a/app/src/utils/getFileIcon.ts b/app/src/utils/getFileIcon.ts index 7eea408..9e7d6d8 100644 --- a/app/src/utils/getFileIcon.ts +++ b/app/src/utils/getFileIcon.ts @@ -14,7 +14,7 @@ const icons: { [key: string]: [IconPrefix, IconName] } = { file: ['far', 'file'], markdown: ['fab', 'markdown'], book: ['fas', 'book'], - link: ['fas', 'link'], + link: ['fas', 'link'] } const extensions = { @@ -92,7 +92,7 @@ const extensions = { mobi: icons.book, azw3: icons.book, - url: icons.link, + url: icons.link } /** @@ -109,9 +109,13 @@ export function hasKey(obj: Record, key: string): boolean { return key in obj } -export function getRawExtension(fileName: string): string { +export function getRawExtension(fileName: string | undefined): string { + if (typeof fileName !== 'string') { + return '' + } return fileName.slice(((fileName.lastIndexOf('.') - 1) >>> 0) + 2) } + export function getExtension(fileName: string): string { return getRawExtension(fileName).toLowerCase() }