enhance(frontend): サイズ制限を超過するファイルをアップロードしようとした際にエラーを出すように
This commit is contained in:
parent
2f009f7d49
commit
8032a4e12a
8 changed files with 21 additions and 5 deletions
|
|
@ -133,7 +133,7 @@ export type Config = {
|
|||
proxySmtp: string | undefined;
|
||||
proxyBypassHosts: string[] | undefined;
|
||||
allowedPrivateNetworks: string[] | undefined;
|
||||
maxFileSize: number | undefined;
|
||||
maxFileSize: number;
|
||||
clusterLimit: number | undefined;
|
||||
id: string;
|
||||
outgoingAddress: string | undefined;
|
||||
|
|
@ -250,7 +250,7 @@ export function loadConfig(): Config {
|
|||
proxySmtp: config.proxySmtp,
|
||||
proxyBypassHosts: config.proxyBypassHosts,
|
||||
allowedPrivateNetworks: config.allowedPrivateNetworks,
|
||||
maxFileSize: config.maxFileSize,
|
||||
maxFileSize: config.maxFileSize ?? 262144000,
|
||||
clusterLimit: config.clusterLimit,
|
||||
outgoingAddress: config.outgoingAddress,
|
||||
outgoingAddressFamily: config.outgoingAddressFamily,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ export class DownloadService {
|
|||
|
||||
const timeout = 30 * 1000;
|
||||
const operationTimeout = 60 * 1000;
|
||||
const maxSize = this.config.maxFileSize ?? 262144000;
|
||||
const maxSize = this.config.maxFileSize;
|
||||
|
||||
const urlObj = new URL(url);
|
||||
let filename = urlObj.pathname.split('/').pop() ?? 'untitled';
|
||||
|
|
|
|||
|
|
@ -129,6 +129,7 @@ export class MetaEntityService {
|
|||
mediaProxy: this.config.mediaProxy,
|
||||
enableUrlPreview: instance.urlPreviewEnabled,
|
||||
noteSearchableScope: (this.config.meilisearch == null || this.config.meilisearch.scope !== 'local') ? 'global' : 'local',
|
||||
maxFileSize: this.config.maxFileSize,
|
||||
};
|
||||
|
||||
return packed;
|
||||
|
|
|
|||
|
|
@ -253,6 +253,10 @@ export const packedMetaLiteSchema = {
|
|||
optional: false, nullable: false,
|
||||
default: 'local',
|
||||
},
|
||||
maxFileSize: {
|
||||
type: 'number',
|
||||
optional: false, nullable: false,
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ export class ApiServerService {
|
|||
|
||||
fastify.register(multipart, {
|
||||
limits: {
|
||||
fileSize: this.config.maxFileSize ?? 262144000,
|
||||
fileSize: this.config.maxFileSize,
|
||||
files: 1,
|
||||
},
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue