summaryrefslogtreecommitdiff
path: root/packages/backend/src
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-05-02 08:37:42 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-05-02 08:37:42 -0400
commit54b5c930cb87189f18b6351a21fd96f91660b5be (patch)
treed8a2ff357f0c4b42e1a717480e052980e8cf67b4 /packages/backend/src
parentupdate description of "enable proxy account" toggle (diff)
downloadsharkey-54b5c930cb87189f18b6351a21fd96f91660b5be.tar.gz
sharkey-54b5c930cb87189f18b6351a21fd96f91660b5be.tar.bz2
sharkey-54b5c930cb87189f18b6351a21fd96f91660b5be.zip
enforce maxFileSize for remote users
Diffstat (limited to 'packages/backend/src')
-rw-r--r--packages/backend/src/core/DriveService.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/backend/src/core/DriveService.ts b/packages/backend/src/core/DriveService.ts
index bb76b680a4..d405b56c4c 100644
--- a/packages/backend/src/core/DriveService.ts
+++ b/packages/backend/src/core/DriveService.ts
@@ -522,11 +522,16 @@ export class DriveService {
if (maxFileSize < info.size) {
if (isLocalUser) {
throw new IdentifiableError('f9e4e5f3-4df4-40b5-b400-f236945f7073', 'Max file size exceeded.');
+ } else {
+ // For remote users, throwing an exception will break Activity processing.
+ // Instead, force "link" mode which does not cache the file locally.
+ isLink = true;
}
}
// If usage limit exceeded
- if (driveCapacity < usage + info.size) {
+ // Repeat the "!isLink" check because it could be set to true by the previous block.
+ if (driveCapacity < usage + info.size && !isLink) {
if (isLocalUser) {
throw new IdentifiableError('c6244ed2-a39a-4e1c-bf93-f0fbd7764fa6', 'No free space.', true);
}