mirror of
https://github.com/docmost/docmost.git
synced 2025-11-19 03:02:09 +10:00
make file upload size limit configurable (#386)
This commit is contained in:
@ -43,6 +43,11 @@ export class EnvironmentService {
|
||||
return this.configService.get<string>('STORAGE_DRIVER', 'local');
|
||||
}
|
||||
|
||||
getFileUploadSizeLimit(): string {
|
||||
|
||||
return this.configService.get<string>('FILE_UPLOAD_SIZE_LIMIT', '50mb');
|
||||
}
|
||||
|
||||
getAwsS3AccessKeyId(): string {
|
||||
return this.configService.get<string>('AWS_S3_ACCESS_KEY_ID');
|
||||
}
|
||||
|
||||
@ -21,7 +21,6 @@ import {
|
||||
import { FileInterceptor } from '../../common/interceptors/file.interceptor';
|
||||
import * as bytes from 'bytes';
|
||||
import * as path from 'path';
|
||||
import { MAX_FILE_SIZE } from '../../core/attachment/attachment.constants';
|
||||
import { ImportService } from './import.service';
|
||||
import { AuthWorkspace } from '../../common/decorators/auth-workspace.decorator';
|
||||
|
||||
@ -45,7 +44,7 @@ export class ImportController {
|
||||
) {
|
||||
const validFileExtensions = ['.md', '.html'];
|
||||
|
||||
const maxFileSize = bytes(MAX_FILE_SIZE);
|
||||
const maxFileSize = bytes('100mb');
|
||||
|
||||
let file = null;
|
||||
try {
|
||||
@ -56,7 +55,7 @@ export class ImportController {
|
||||
this.logger.error(err.message);
|
||||
if (err?.statusCode === 413) {
|
||||
throw new BadRequestException(
|
||||
`File too large. Exceeds the ${MAX_FILE_SIZE} limit`,
|
||||
`File too large. Exceeds the 100mb import limit`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@ -33,6 +33,7 @@ export class StaticModule implements OnModuleInit {
|
||||
ENV: this.environmentService.getNodeEnv(),
|
||||
APP_URL: this.environmentService.getAppUrl(),
|
||||
IS_CLOUD: this.environmentService.isCloud(),
|
||||
FILE_UPLOAD_SIZE_LIMIT: this.environmentService.getFileUploadSizeLimit()
|
||||
};
|
||||
|
||||
const windowScriptContent = `<script>window.CONFIG=${JSON.stringify(configString)};</script>`;
|
||||
|
||||
Reference in New Issue
Block a user