diff --git a/backend/src/share/share.service.ts b/backend/src/share/share.service.ts index 2d33997..22273e3 100644 --- a/backend/src/share/share.service.ts +++ b/backend/src/share/share.service.ts @@ -105,9 +105,10 @@ export class ShareService { ); // Asynchronously create a zip of all files - this.createZip(id).then(() => - this.prisma.share.update({ where: { id }, data: { isZipReady: true } }) - ); + if (share.files.length > 1) + this.createZip(id).then(() => + this.prisma.share.update({ where: { id }, data: { isZipReady: true } }) + ); // Send email for each recepient for (const recepient of share.recipients) { diff --git a/frontend/src/pages/share/[shareId].tsx b/frontend/src/pages/share/[shareId].tsx index 2555f79..7e2f9b7 100644 --- a/frontend/src/pages/share/[shareId].tsx +++ b/frontend/src/pages/share/[shareId].tsx @@ -17,7 +17,7 @@ export function getServerSideProps(context: GetServerSidePropsContext) { const Share = ({ shareId }: { shareId: string }) => { const modals = useModals(); - const [fileList, setFileList] = useState([]); + const [files, setFiles] = useState([]); const getShareToken = async (password?: string) => { await shareService @@ -41,7 +41,7 @@ const Share = ({ shareId }: { shareId: string }) => { shareService .get(shareId) .then((share) => { - setFileList(share.files); + setFiles(share.files); }) .catch((e) => { const { error } = e.response.data; @@ -77,14 +77,12 @@ const Share = ({ shareId }: { shareId: string }) => { title={`Share ${shareId}`} description="Look what I've shared with you." /> - - - - + {files.length > 1 && ( + + + + )} + ); };