Skip to content

Commit 38872d4

Browse files
authored
Merge pull request #511 from mfts/feat/bulk
2 parents 98fe29b + df8764a commit 38872d4

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

pages/api/file/tus/[[...file]].ts

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ const tusServer = new Server({
4343
},
4444
generateUrl(req, { proto, host, path, id }) {
4545
// Encode the ID to be URL safe
46+
console.log("proto", proto);
4647
id = Buffer.from(id, "utf-8").toString("base64url");
47-
return `${proto}://${host}${path}/${id}`;
48+
return `${proto}s://${host}${path}/${id}`;
4849
},
4950
getFileIdFromRequest(req) {
5051
// Extract the ID from the URL
@@ -54,25 +55,25 @@ const tusServer = new Server({
5455
});
5556

5657
export default function handler(req: NextApiRequest, res: NextApiResponse) {
57-
// Set CORS headers for all responses
58-
res.setHeader(
59-
"Access-Control-Allow-Methods",
60-
"GET,POST,PUT,HEAD,DELETE,OPTIONS",
61-
);
62-
res.setHeader(
63-
"Access-Control-Allow-Headers",
64-
"Content-Type,Upload-Length,Upload-Offset,Upload-Metadata,Upload-Defer-Length,Upload-Concat",
65-
);
66-
res.setHeader(
67-
"Access-Control-Expose-Headers",
68-
"Upload-Offset,Upload-Length,Location",
69-
);
58+
// // Set CORS headers for all responses
59+
// res.setHeader(
60+
// "Access-Control-Allow-Methods",
61+
// "GET,POST,PUT,HEAD,DELETE,OPTIONS",
62+
// );
63+
// res.setHeader(
64+
// "Access-Control-Allow-Headers",
65+
// "Content-Type,Upload-Length,Upload-Offset,Upload-Metadata,Upload-Defer-Length,Upload-Concat",
66+
// );
67+
// res.setHeader(
68+
// "Access-Control-Expose-Headers",
69+
// "Upload-Offset,Upload-Length,Location",
70+
// );
7071

71-
if (req.method === "OPTIONS") {
72-
// Handle preflight requests
73-
res.status(204).end();
74-
return;
75-
}
72+
// if (req.method === "OPTIONS") {
73+
// // Handle preflight requests
74+
// res.status(204).end();
75+
// return;
76+
// }
7677

7778
// Get the session
7879
const session = getServerSession(req, res, authOptions);

0 commit comments

Comments
 (0)