Hotfix: removed data64 avatar for 4mb payload limit

This commit is contained in:
zomars committed 2022-10-17 13:52:04 -06:00
1 parent c1b41d8251
commit 05f303bfad
2 files changed
+3 -1

No files matched your search

-1
View File
@@ -26,7 +26,6 @@ export const baseUserSelect = Prisma.validator<Prisma.UserSelect>()({
destinationCalendar: true,
locale: true,
plan: true,
avatar: true,
hideBranding: true,
theme: true,
brandColor: true,
+3
View File
@@ -3,6 +3,7 @@ import type { Session } from "next-auth";
import { serverSideTranslations } from "next-i18next/serverSideTranslations";
import { getSession } from "@calcom/lib/auth";
import { CAL_URL } from "@calcom/lib/constants";
import { getLocaleFromHeaders } from "@calcom/lib/i18n";
import { defaultAvatarSrc } from "@calcom/lib/profile";
import prisma from "@calcom/prisma";
@@ -85,6 +86,8 @@ async function getUserFromSession({
if (!email) {
return null;
}
// This helps to prevent reaching the 4MB payload limit by avoiding base64 and instead passing the avatar url
if (user.avatar) user.avatar = `${CAL_URL}/${user.username}/avatar.png`;
const avatar = user.avatar || defaultAvatarSrc({ email });
const locale = user.locale || getLocaleFromHeaders(req);