Skip to content

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

revert: fix

Marc Seitz4afc43cd4745
diff --git a/lib/files/get-file.ts b/lib/files/get-file.ts
index 0e1d8bd0..5248e646 100644
--- a/lib/files/get-file.ts
+++ b/lib/files/get-file.ts
@@ -34,7 +34,7 @@ const getFileFromS3 = async (key: string) => {
method: "POST",
headers: {
"Content-Type": "application/json",
- // Authorization: `Bearer ${process.env.INTERNAL_API_KEY}`,
+ Authorization: `Bearer ${process.env.INTERNAL_API_KEY}`,
},
body: JSON.stringify({ key: key }),
},
diff --git a/pages/api/file/s3/get-presigned-get-url.ts b/pages/api/file/s3/get-presigned-get-url.ts
index c051563e..c05572b1 100644
--- a/pages/api/file/s3/get-presigned-get-url.ts
+++ b/pages/api/file/s3/get-presigned-get-url.ts
@@ -18,28 +18,28 @@ export default async function handler(
return res.status(405).end("Method Not Allowed");
}
- // // Extract the API Key from the Authorization header
- // const authHeader = req.headers.authorization;
- // if (!authHeader || !authHeader.startsWith("Bearer ")) {
- // return res.status(401).json({ message: "Unauthorized" });
- // }
- // const token = authHeader.split(" ")[1]; // Assuming the format is "Bearer [token]"
+ // Extract the API Key from the Authorization header
+ const authHeader = req.headers.authorization;
+ if (!authHeader || !authHeader.startsWith("Bearer ")) {
+ return res.status(401).json({ message: "Unauthorized" });
+ }
+ const token = authHeader.split(" ")[1]; // Assuming the format is "Bearer [token]"
- // if (!token) {
- // return res.status(401).json({ message: "Unauthorized" });
- // }
+ if (!token) {
+ return res.status(401).json({ message: "Unauthorized" });
+ }
- // // Check if the API Key matches
- // if (!process.env.INTERNAL_API_KEY) {
- // log({
- // message: "INTERNAL_API_KEY environment variable is not set",
- // type: "error",
- // });
- // return res.status(500).json({ message: "Server configuration error" });
- // }
- // if (token !== process.env.INTERNAL_API_KEY) {
- // return res.status(401).json({ message: "Unauthorized" });
- // }
+ // Check if the API Key matches
+ if (!process.env.INTERNAL_API_KEY) {
+ log({
+ message: "INTERNAL_API_KEY environment variable is not set",
+ type: "error",
+ });
+ return res.status(500).json({ message: "Server configuration error" });
+ }
+ if (token !== process.env.INTERNAL_API_KEY) {
+ return res.status(401).json({ message: "Unauthorized" });
+ }
const { key } = req.body as { key: string };