Skip to content

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

fix: escape if no CONTENT_BASE_URL env present

Marc Seitz1510668bf0eb
diff --git a/lib/content/alternative.ts b/lib/content/alternative.ts
index ebf14a53..369232d3 100644
--- a/lib/content/alternative.ts
+++ b/lib/content/alternative.ts
@@ -28,6 +28,10 @@ type Alternative = {
// this means getPosts() will only be called once per page build, even though we may call it multiple times
// when rendering the page.
export const getAlternatives = async () => {
+ if (!process.env.CONTENT_BASE_URL) {
+ return [];
+ }
+
const response = await fetch(
`${process.env.CONTENT_BASE_URL}/api/alternatives`,
{
diff --git a/lib/content/blog.ts b/lib/content/blog.ts
index da20f4f0..21f66586 100644
--- a/lib/content/blog.ts
+++ b/lib/content/blog.ts
@@ -18,6 +18,10 @@ const GITHUB_CONTENT_TOKEN = process.env.GITHUB_CONTENT_TOKEN;
const GITHUB_CONTENT_REPO = process.env.GITHUB_CONTENT_REPO;
export const getPostsRemote = cache(async () => {
+ if (!GITHUB_CONTENT_REPO || !GITHUB_CONTENT_TOKEN) {
+ return [];
+ }
+
const apiUrl = `https://api.github.com/repos/${GITHUB_CONTENT_REPO}/contents/content/blog`;
const headers = {
Authorization: `Bearer ${GITHUB_CONTENT_TOKEN}`,
diff --git a/lib/content/investor.ts b/lib/content/investor.ts
index 9c523547..b0731067 100644
--- a/lib/content/investor.ts
+++ b/lib/content/investor.ts
@@ -16,6 +16,10 @@ type Investor = {
// this means getPosts() will only be called once per page build, even though we may call it multiple times
// when rendering the page.
export const getInvestors = cache(async () => {
+ if (!process.env.CONTENT_BASE_URL) {
+ return [];
+ }
+
const response = await fetch(
`${process.env.CONTENT_BASE_URL}/api/investors`,
{
diff --git a/lib/content/page.ts b/lib/content/page.ts
index ffee93c4..be57b38c 100644
--- a/lib/content/page.ts
+++ b/lib/content/page.ts
@@ -22,6 +22,10 @@ type Page = {
// this means getPosts() will only be called once per page build, even though we may call it multiple times
// when rendering the page.
export const getPages = async () => {
+ if (!process.env.CONTENT_BASE_URL) {
+ return [];
+ }
+
const response = await fetch(`${process.env.CONTENT_BASE_URL}/api/pages`, {
method: "GET",
headers: {