From e7175fbe87b2da711595d344abb9fd195dd29f9a Mon Sep 17 00:00:00 2001 From: ekzyis Date: Wed, 25 Oct 2023 17:05:30 +0200 Subject: [PATCH] Use megabytes in error message --- api/resolvers/upload.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/api/resolvers/upload.js b/api/resolvers/upload.js index 891d7633..b2dde455 100644 --- a/api/resolvers/upload.js +++ b/api/resolvers/upload.js @@ -10,7 +10,8 @@ export default { } if (size > UPLOAD_SIZE_MAX) { - throw new GraphQLError(`image must be less than ${UPLOAD_SIZE_MAX} bytes`, { extensions: { code: 'BAD_INPUT' } }) + const UPLOAD_SIZE_MAX_MB = UPLOAD_SIZE_MAX / 1024 / 1024 + throw new GraphQLError(`image must be less than ${UPLOAD_SIZE_MAX_MB} megabytes`, { extensions: { code: 'BAD_INPUT' } }) } if (width * height > IMAGE_PIXELS_MAX) {