fix(pages): fix embed route not loading images

This commit is contained in:
diced 2021-06-23 21:44:01 -07:00
parent 9d3443ceac
commit 6733c9adba
No known key found for this signature in database
GPG key ID: 85AB64C74535D76E

View file

@ -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,