diff --git a/src/shared/dto/baseline-data.dto.ts b/src/shared/dto/baseline-data.dto.ts index e648455c..64340e60 100644 --- a/src/shared/dto/baseline-data.dto.ts +++ b/src/shared/dto/baseline-data.dto.ts @@ -26,7 +26,7 @@ export class BaselineDataDto { @IsString() device?: string; - @ApiProperty() + @ApiPropertyOptional() @IsOptional() @IsString() customTags?: string; diff --git a/src/shared/static/static.service.ts b/src/shared/static/static.service.ts index 09aad0c4..d0947aa0 100644 --- a/src/shared/static/static.service.ts +++ b/src/shared/static/static.service.ts @@ -23,6 +23,12 @@ export class StaticService { } saveImage(type: 'screenshot' | 'diff' | 'baseline', imageBuffer: Buffer): string { + try { + new PNG().parse(imageBuffer); + } catch (ex) { + throw new Error('Cannot parse image as PNG file'); + } + const { imageName, imagePath } = this.generateNewImage(type); writeFileSync(imagePath, imageBuffer); return imageName;