fix(pages): fix embed route not loading images
This commit is contained in:
parent
9d3443ceac
commit
6733c9adba
1 changed files with 9 additions and 1 deletions
|
@ -6,7 +6,8 @@ import config from 'lib/config';
|
|||
import prisma from 'lib/prisma';
|
||||
|
||||
export default function EmbeddedImage({ image, title, username, color, normal, embed }) {
|
||||
const dataURL = (route: string) => `/${route}/${image.file}`;
|
||||
console.log(normal, embed);
|
||||
const dataURL = (route: string) => `${route}/${image.file}`;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
@ -71,6 +72,13 @@ export const getServerSideProps: GetServerSideProps = async (context) => {
|
|||
notFound: true
|
||||
};
|
||||
|
||||
if (!image.mimetype.startsWith('image')) return {
|
||||
redirect: {
|
||||
permanent: true,
|
||||
destination: `${config.uploader.route}/${image.file}`,
|
||||
}
|
||||
};
|
||||
|
||||
return {
|
||||
props: {
|
||||
image,
|
||||
|
|
Loading…
Reference in a new issue