Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

fix: added condition to check if the file type is notion or not

Ashraffd0f9d21bcb1
diff --git a/pages/api/teams/[teamId]/documents/index.ts b/pages/api/teams/[teamId]/documents/index.ts
index a48e7cee..d7e8447c 100644
--- a/pages/api/teams/[teamId]/documents/index.ts
+++ b/pages/api/teams/[teamId]/documents/index.ts
@@ -87,12 +87,16 @@ export default async function handle(
const type = fileType || getExtension(name);
// Check whether the Notion page is publically accessible or not
- try {
- const pageId = parsePageId(fileUrl, { uuid: false });
- // if the page isn't accessible then end the process here.
- await notion.getPage(pageId);
- } catch (error) {
- return res.status(404).end("This Notion page isn't publically available.");
+ if (type === "notion") {
+ try {
+ const pageId = parsePageId(fileUrl, { uuid: false });
+ // if the page isn't accessible then end the process here.
+ await notion.getPage(pageId);
+ } catch (error) {
+ return res
+ .status(404)
+ .end("This Notion page isn't publically available.");
+ }
}
// Save data to the database