feat: make progressive system config optional (#25486)

This commit is contained in:
Min Idzelis
2026-01-24 00:18:02 -05:00
committed by GitHub
parent ccc0961ba3
commit 7e5592fec5
7 changed files with 42 additions and 16 deletions

View File

@@ -70,5 +70,33 @@ describe(SystemConfigController.name, () => {
expect(body).toEqual(errorDto.badRequest(['nightlyTasks.databaseCleanup must be a boolean value']));
});
});
describe('image', () => {
it('should accept config without optional progressive property', async () => {
const config = _.cloneDeep(defaults);
delete config.image.thumbnail.progressive;
delete config.image.preview.progressive;
delete config.image.fullsize.progressive;
const { status } = await request(ctx.getHttpServer()).put('/system-config').send(config);
expect(status).toBe(200);
});
it('should accept config with progressive set to true', async () => {
const config = _.cloneDeep(defaults);
config.image.thumbnail.progressive = true;
config.image.preview.progressive = true;
config.image.fullsize.progressive = true;
const { status } = await request(ctx.getHttpServer()).put('/system-config').send(config);
expect(status).toBe(200);
});
it('should reject invalid progressive value', async () => {
const config = _.cloneDeep(defaults);
(config.image.thumbnail.progressive as any) = 'invalid';
const { status, body } = await request(ctx.getHttpServer()).put('/system-config').send(config);
expect(status).toBe(400);
expect(body).toEqual(errorDto.badRequest(['image.thumbnail.progressive must be a boolean value']));
});
});
});
});

View File

@@ -586,8 +586,8 @@ class SystemConfigGeneratedImageDto {
@ApiProperty({ type: 'integer' })
size!: number;
@ValidateBoolean()
progressive!: boolean;
@ValidateBoolean({ optional: true, default: false })
progressive?: boolean;
}
class SystemConfigGeneratedFullsizeImageDto {
@@ -604,8 +604,8 @@ class SystemConfigGeneratedFullsizeImageDto {
@ApiProperty({ type: 'integer' })
quality!: number;
@ValidateBoolean()
progressive!: boolean;
@ValidateBoolean({ optional: true, default: false })
progressive?: boolean;
}
export class SystemConfigImageDto {

View File

@@ -36,14 +36,14 @@ export type FullsizeImageOptions = {
format: ImageFormat;
quality: number;
enabled: boolean;
progressive: boolean;
progressive?: boolean;
};
export type ImageOptions = {
format: ImageFormat;
quality: number;
size: number;
progressive: boolean;
progressive?: boolean;
};
export type RawImageInfo = {