From 6bb1b1ac1d1d7b5c7c0456b7b59558955632796f Mon Sep 17 00:00:00 2001 From: Tom Moor Date: Tue, 13 Sep 2022 09:09:04 +0100 Subject: [PATCH] fix: Include the maximum document import size in the error message --- app/stores/DocumentsStore.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/stores/DocumentsStore.ts b/app/stores/DocumentsStore.ts index a8191ed4f..80eb6dbba 100644 --- a/app/stores/DocumentsStore.ts +++ b/app/stores/DocumentsStore.ts @@ -4,6 +4,7 @@ import { find, orderBy, filter, compact, omitBy } from "lodash"; import { observable, action, computed, runInAction } from "mobx"; import { DateFilter } from "@shared/types"; import { subtractDate } from "@shared/utils/date"; +import { bytesToHumanReadable } from "@shared/utils/files"; import naturalSort from "@shared/utils/naturalSort"; import { DocumentValidation } from "@shared/validations"; import BaseStore from "~/stores/BaseStore"; @@ -583,7 +584,11 @@ export default class DocumentsStore extends BaseStore { } if (file.size > env.MAXIMUM_IMPORT_SIZE) { - throw new Error("The selected file was too large to import"); + throw new Error( + `The selected file was larger than the ${bytesToHumanReadable( + env.MAXIMUM_IMPORT_SIZE + )} maximum size` + ); } const title = file.name.replace(/\.[^/.]+$/, "");