From fad501a562422992fd24b47239d5a7d95408b88e Mon Sep 17 00:00:00 2001 From: spencerwooo Date: Sun, 23 Jan 2022 15:43:36 +0800 Subject: [PATCH] error message for sharepoint search, and minor style fix --- components/Navbar.tsx | 4 ++-- components/SearchModal.tsx | 9 ++++++++- pages/onedrive-vercel-index-oauth/step-2.tsx | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/components/Navbar.tsx b/components/Navbar.tsx index 3c24540..d2c09bf 100644 --- a/components/Navbar.tsx +++ b/components/Navbar.tsx @@ -75,10 +75,10 @@ const Navbar = () => {
-
+
{os === 'mac' ? '⌘' : 'Ctrl'}
-
K
+
K
diff --git a/components/SearchModal.tsx b/components/SearchModal.tsx index 5b9e7ae..38aa27f 100644 --- a/components/SearchModal.tsx +++ b/components/SearchModal.tsx @@ -25,7 +25,14 @@ function useDriveItemSearch() { // Map parentReference to the absolute path of the search result data.map(item => { - item['path'] = `${mapAbsolutePath(item.parentReference.path)}/${encodeURIComponent(item.name)}` + // TODO: supporting sharepoint search where the path is not returned in parentReference + if ('path' in item.parentReference) { + item['path'] = `${mapAbsolutePath(item.parentReference.path)}/${encodeURIComponent(item.name)}` + } else { + throw Error( + 'We currently only support search in OneDrive international. SharePoint instances are not supported yet. See issue: https://github.com/spencerwooo/onedrive-vercel-index/issues/299' + ) + } }) return data diff --git a/pages/onedrive-vercel-index-oauth/step-2.tsx b/pages/onedrive-vercel-index-oauth/step-2.tsx index 6cadfa6..a71986b 100644 --- a/pages/onedrive-vercel-index-oauth/step-2.tsx +++ b/pages/onedrive-vercel-index-oauth/step-2.tsx @@ -91,7 +91,7 @@ export default function OAuthStep2() { />

The authorisation code extracted is:

-

+

{authCode || Waiting for code...}