Refine material pack policy recovery guidance

This commit is contained in:
gitea committed 2026-09-08 15:10:39 +08:00
1 parent 79c9420e4e
commit 799cdd1b17
5 files changed
+95 -13

No files matched your search

+14 -2
View File
@@ -206,6 +206,9 @@ export function webhookShowSecretOption(options: Record<string, string | boolean
export function materialPackFilePolicyOptions(
options: Record<string, string | boolean>
): MaterialPackFilePolicyPatch | undefined {
const clearMaxFileSize = booleanOption(
options.clearMaxFileSize ?? options["clear-max-file-size"]
) === true;
const minFileSizeBytes = numberOption(
options.minFileSizeBytes ?? options["min-file-size-bytes"] ?? options.minFileSize ?? options["min-file-size"]
);
@@ -216,9 +219,18 @@ export function materialPackFilePolicyOptions(
options.allowedExtensions ?? options["allowed-extensions"] ?? options.extensions
);
if (minFileSizeBytes === undefined && maxFileSizeBytes === undefined && allowedExtensions === undefined) {
if (
minFileSizeBytes === undefined &&
maxFileSizeBytes === undefined &&
allowedExtensions === undefined &&
!clearMaxFileSize
) {
return undefined;
}
return { minFileSizeBytes, maxFileSizeBytes, allowedExtensions };
return {
minFileSizeBytes,
maxFileSizeBytes: clearMaxFileSize ? null : maxFileSizeBytes,
allowedExtensions
};
}