Skip to content

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

feat(tus): fix protocol for chunks

Marc Seitz9fa9cd523a92
diff --git a/pages/api/file/tus/[[...file]].ts b/pages/api/file/tus/[[...file]].ts
index 0f6ebcff..aff0802a 100644
--- a/pages/api/file/tus/[[...file]].ts
+++ b/pages/api/file/tus/[[...file]].ts
@@ -43,9 +43,10 @@ const tusServer = new Server({
},
generateUrl(req, { proto, host, path, id }) {
// Encode the ID to be URL safe
- console.log("proto", proto);
id = Buffer.from(id, "utf-8").toString("base64url");
- return `${proto}s://${host}${path}/${id}`;
+ // INFO: hardcoding the protocol to https for now - https://github.com/tus/tus-node-server/issues/635
+ proto = process.env.NODE_ENV === "development" ? "http" : "https";
+ return `${proto}://${host}${path}/${id}`;
},
getFileIdFromRequest(req) {
// Extract the ID from the URL