🐛 Fixed bug with downloading zip folder (#541)

* 🐛Fixed bug with downloading zip folder
* ♻️Removed unused method
This commit is contained in:
Anton Shepilov
2024-05-28 13:41:11 +02:00
committed by GitHub
parent 8f75c04fdd
commit 16b39561ae
7 changed files with 29 additions and 13 deletions
@@ -311,10 +311,11 @@ export const addDriveItemToArchive = async (
context: CompanyExecutionContext,
prefix?: string,
): Promise<void> => {
const item = entity || (await repository.findOne({ id, company_id: context.company.id }));
const itemPK = { id, company_id: context.company.id };
const item = entity || (await repository.findOne(itemPK));
if (!item) {
throw Error("item not found");
throw Error(`Item '${JSON.stringify(itemPK)}' not found`);
}
if (!item.is_directory) {
@@ -427,6 +427,8 @@ export class DocumentsController {
});
archive.pipe(reply.raw);
return reply;
} catch (error) {
logger.error({ error: `${error}` }, "failed to send zip file");
throw new CrudException("Failed to create zip file", 500);