diff options
author | bobzel <zzzman@gmail.com> | 2022-09-21 21:55:27 -0400 |
---|---|---|
committer | bobzel <zzzman@gmail.com> | 2022-09-21 21:55:27 -0400 |
commit | dc5d5d318ad4ebc99e7c1302057e1b6e132f5017 (patch) | |
tree | 6d7d4e64ad9b23b0616e70b8363a56a65d43e784 /src/client/Network.ts | |
parent | 05cfb0b626016e3fb77e0f7b4e5b3cca08e4f2f9 (diff) |
imposed 50MB max file size for uploads
Diffstat (limited to 'src/client/Network.ts')
-rw-r--r-- | src/client/Network.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/client/Network.ts b/src/client/Network.ts index a222b320f..996eb35d8 100644 --- a/src/client/Network.ts +++ b/src/client/Network.ts @@ -30,6 +30,17 @@ export namespace Networking { if (!files.length) { return []; } + const maxFileSize = 50000000; + if (files.some(f => f.size > maxFileSize)) { + return new Promise<any>(res => + res([ + { + source: { name: '', type: '', size: 0, toJson: () => ({ name: '', type: '' }) }, + result: { name: '', message: `max file size (${maxFileSize / 1000000}MB) exceeded` }, + }, + ]) + ); + } files.forEach(file => formData.append(Utils.GenerateGuid(), file)); } else { formData.append(Utils.GenerateGuid(), files); |