Fix units of maximum attachment size
This commit is contained in:
parent
198d6f7e26
commit
487bb58880
3 changed files with 16 additions and 13 deletions
|
@ -14,20 +14,23 @@ import type { LoggerType } from '../types/Logging';
|
|||
import * as MIME from '../types/MIME';
|
||||
import * as Errors from '../types/errors';
|
||||
|
||||
export const KIBIBYTE = 1024;
|
||||
const MEBIBYTE = 1024 * 1024;
|
||||
const DEFAULT_MAX = 100 * MEBIBYTE;
|
||||
|
||||
export const getMaximumAttachmentSize = (): number => {
|
||||
export const getMaximumAttachmentSizeInKb = (): number => {
|
||||
try {
|
||||
return parseIntOrThrow(
|
||||
getValue('global.attachments.maxBytes'),
|
||||
'preProcessAttachment/maxAttachmentSize'
|
||||
return (
|
||||
parseIntOrThrow(
|
||||
getValue('global.attachments.maxBytes'),
|
||||
'preProcessAttachment/maxAttachmentSize'
|
||||
) / KIBIBYTE
|
||||
);
|
||||
} catch (error) {
|
||||
log.warn(
|
||||
'Failed to parse integer out of global.attachments.maxBytes feature flag'
|
||||
);
|
||||
return DEFAULT_MAX;
|
||||
return DEFAULT_MAX / KIBIBYTE;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue