fix: branding logos (#1759)

This commit is contained in:
David Nguyen
2025-04-24 16:15:06 +10:00
committed by GitHub
parent f0dcf7e9bf
commit d78cfec00e

View File

@ -1,6 +1,6 @@
import sharp from 'sharp';
import { getFile } from '@documenso/lib/universal/upload/get-file';
import { getFileServerSide } from '@documenso/lib/universal/upload/get-file.server';
import { prisma } from '@documenso/prisma';
import type { Route } from './+types/branding.logo.team.$teamId';
@ -24,27 +24,29 @@ export async function loader({ params }: Route.LoaderArgs) {
},
});
if (!settings || !settings.brandingEnabled) {
if (!settings || !settings.brandingLogo) {
return Response.json(
{
status: 'error',
message: 'Not found',
message: 'Logo not found',
},
{ status: 404 },
);
}
if (!settings.brandingLogo) {
if (!settings.brandingEnabled) {
return Response.json(
{
status: 'error',
message: 'Not found',
message: 'Branding is not enabled',
},
{ status: 404 },
{ status: 400 },
);
}
const file = await getFile(JSON.parse(settings.brandingLogo)).catch(() => null);
const file = await getFileServerSide(JSON.parse(settings.brandingLogo)).catch((e) => {
console.error(e);
});
if (!file) {
return Response.json(