fix(ithc): correct server-side session retrieval for file APIs

This commit is contained in:
2026-11-03 09:25:02 +00:00
parent d417860d1d
commit bb50b17277
6 changed files with 239 additions and 35 deletions
+3 -2
View File
@@ -1,7 +1,8 @@
import { hashAPIPath } from "../../../actions/core/hash";
import { deleteBlobRep } from "../../../actions/azurestorage";
import { respondError, respondSuccess } from "../middleware/apiResponse";
import { getSession } from "next-auth/react";
import { getServerSession } from "next-auth/next";
import { authOptions } from "../auth/[...nextauth]";
import nextConnect from "next-connect";
import middleware from "../middleware/middleware";
@@ -42,7 +43,7 @@ ApiProxy.get(async (req, res) => {
const casefolderIDTrimmed = casefolderID.trim();
const repfileTrimmed = repfile.trim();
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 ||