mirror of
https://github.com/documenso/documenso.git
synced 2025-11-13 08:13:56 +10:00
fix: branding logos (#1759)
This commit is contained in:
@ -1,6 +1,6 @@
|
|||||||
import sharp from 'sharp';
|
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 { prisma } from '@documenso/prisma';
|
||||||
|
|
||||||
import type { Route } from './+types/branding.logo.team.$teamId';
|
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(
|
return Response.json(
|
||||||
{
|
{
|
||||||
status: 'error',
|
status: 'error',
|
||||||
message: 'Not found',
|
message: 'Logo not found',
|
||||||
},
|
},
|
||||||
{ status: 404 },
|
{ status: 404 },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!settings.brandingLogo) {
|
if (!settings.brandingEnabled) {
|
||||||
return Response.json(
|
return Response.json(
|
||||||
{
|
{
|
||||||
status: 'error',
|
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) {
|
if (!file) {
|
||||||
return Response.json(
|
return Response.json(
|
||||||
|
|||||||
Reference in New Issue
Block a user