@@ -43,8 +43,9 @@ const tusServer = new Server({
43
43
} ,
44
44
generateUrl ( req , { proto, host, path, id } ) {
45
45
// Encode the ID to be URL safe
46
+ console . log ( "proto" , proto ) ;
46
47
id = Buffer . from ( id , "utf-8" ) . toString ( "base64url" ) ;
47
- return `${ proto } ://${ host } ${ path } /${ id } ` ;
48
+ return `${ proto } s ://${ host } ${ path } /${ id } ` ;
48
49
} ,
49
50
getFileIdFromRequest ( req ) {
50
51
// Extract the ID from the URL
@@ -54,25 +55,25 @@ const tusServer = new Server({
54
55
} ) ;
55
56
56
57
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
+ // );
70
71
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
+ // }
76
77
77
78
// Get the session
78
79
const session = getServerSession ( req , res , authOptions ) ;
0 commit comments