summaryrefslogtreecommitdiff
path: root/packages/backend/src/core/DriveService.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-04-27 09:35:44 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-04-27 09:35:44 +0900
commit9481b5a6e8dc55c30b1521b97405973052c15117 (patch)
tree0ce7b18abdb3ebaf3f731647a305ac67d64ef6ab /packages/backend/src/core/DriveService.ts
parentBump version to 2025.4.1-beta.0 (diff)
downloadsharkey-9481b5a6e8dc55c30b1521b97405973052c15117.tar.gz
sharkey-9481b5a6e8dc55c30b1521b97405973052c15117.tar.bz2
sharkey-9481b5a6e8dc55c30b1521b97405973052c15117.zip
feat: アップロード可能な最大ファイルサイズをロールごとに設定可能に
Diffstat (limited to 'packages/backend/src/core/DriveService.ts')
-rw-r--r--packages/backend/src/core/DriveService.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts
index 1550fe3d3c..5f1e373429 100644
--- a/packages/backend/src/core/DriveService.ts
+++ b/packages/backend/src/core/DriveService.ts
@@ -522,9 +522,16 @@ export class DriveService {
const policies = await this.roleService.getUserPolicies(user.id);
const driveCapacity = 1024 * 1024 * policies.driveCapacityMb;
+ const maxFileSize = 1024 * 1024 * policies.maxFileSizeMb;
this.registerLogger.debug('drive capacity override applied');
this.registerLogger.debug(`overrideCap: ${driveCapacity}bytes, usage: ${usage}bytes, u+s: ${usage + info.size}bytes`);
+ if (maxFileSize < info.size) {
+ if (isLocalUser) {
+ throw new IdentifiableError('f9e4e5f3-4df4-40b5-b400-f236945f7073', 'Max file size exceeded.');
+ }
+ }
+
// If usage limit exceeded
if (driveCapacity < usage + info.size) {
if (isLocalUser) {