Skip to content

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

chore: cleanup

Marc Seitz268420482720
diff --git a/lib/files/put-file.ts b/lib/files/put-file.ts
index 62ee1042..9b054d0f 100644
--- a/lib/files/put-file.ts
+++ b/lib/files/put-file.ts
@@ -37,14 +37,14 @@ export const putFile = async ({
};
const putFileInVercel = async (file: File) => {
- const contents = await file.arrayBuffer();
- const numPages = await getPagesCount(contents);
-
const newBlob = await upload(file.name, file, {
access: "public",
handleUploadUrl: "/api/file/browser-upload",
});
+ const contents = await file.arrayBuffer();
+ const numPages = await getPagesCount(contents);
+
return {
type: DocumentStorageType.VERCEL_BLOB,
data: newBlob.url,
@@ -91,12 +91,6 @@ const putFileInS3 = async ({
key: string;
};
- const body = await file.arrayBuffer();
-
- const numPages = await getPagesCount(body);
-
- // const constructedFile = new File([body], file.name, { type: file.type });
-
const response = await fetch(url, {
method: "PUT",
headers: {
@@ -105,14 +99,15 @@ const putFileInS3 = async ({
body: file,
});
- console.log("response", response);
-
if (!response.ok) {
throw new Error(
`Failed to upload file "${file.name}", failed with status code ${response.status}`,
);
}
+ const body = await file.arrayBuffer();
+ const numPages = await getPagesCount(body);
+
return {
type: DocumentStorageType.S3_PATH,
data: key,
diff --git a/pages/api/file/s3/get-presigned-get-url.ts b/pages/api/file/s3/get-presigned-get-url.ts
index 2c3149b4..5f6e255c 100644
--- a/pages/api/file/s3/get-presigned-get-url.ts
+++ b/pages/api/file/s3/get-presigned-get-url.ts
@@ -25,8 +25,6 @@ export default async function handler(
`${process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_DOMAIN}`,
);
- console.log("distribution url", distributionUrl.toString());
-
const url = getCloudfrontSignedUrl({
url: distributionUrl.toString(),
keyPairId: `${process.env.NEXT_PRIVATE_UPLOAD_DISTRIBUTION_KEY_ID}`,
@@ -34,8 +32,6 @@ export default async function handler(
dateLessThan: new Date(Date.now() + ONE_HOUR).toISOString(),
});
- console.log("cloudfront signed url", url);
-
return res.status(200).json({ url });
}