fix(ithc): correct server-side session retrieval for file APIs
This commit is contained in:
@@ -6,7 +6,8 @@ import { consoleLogger } from "../../../actions/core/logger";
|
||||
import { hashAPIPath } from "../../../actions/core/hash";
|
||||
import { respondError, respondSuccess } from "../middleware/apiResponse";
|
||||
import { fileTypeFromBuffer } from "file-type";
|
||||
import { getSession } from "next-auth/react";
|
||||
import { getServerSession } from "next-auth/next";
|
||||
import { authOptions } from "../auth/[...nextauth]";
|
||||
import fs from "fs";
|
||||
import path from "path";
|
||||
|
||||
@@ -52,7 +53,7 @@ const forbidden = (res) =>
|
||||
});
|
||||
|
||||
ApiProxy.post(async (req, res) => {
|
||||
const session = await getSession({ req });
|
||||
const session = await getServerSession(req, res, authOptions(req, res));
|
||||
if (
|
||||
typeof session?.user?.id !== "string" ||
|
||||
session.user.id.length === 0
|
||||
|
||||
Reference in New Issue
Block a user