Skip to content

Commit bab7d58

Browse files
authored
fix(#449): filename collisions (#329)
1 parent 13eeb6e commit bab7d58

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

package-lock.json

Lines changed: 47 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,7 @@
8888
"eslint-config-prettier": "^9.0.0",
8989
"eslint-plugin-import": "^2.28.1",
9090
"jest": "^29.6.4",
91+
"jest-mock-extended": "^4.0.0-beta1",
9192
"prettier": "^3.0.3",
9293
"prisma": "^5.3.1",
9394
"supertest": "^6.3.3",

src/static/hdd/hdd.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ import { Logger } from '@nestjs/common';
22
import path from 'path';
33
import { writeFileSync, readFileSync, unlink, mkdirSync, existsSync } from 'fs';
44
import { PNG, PNGWithMetadata } from 'pngjs';
5+
import uuidAPIKey from 'uuid-apikey';
56
import { Static } from '../static.interface';
67
import { HDD_IMAGE_PATH } from './constants';
78

89
export class HddService implements Static {
910
private readonly logger: Logger = new Logger(HddService.name);
1011

1112
generateNewImage(type: 'screenshot' | 'diff' | 'baseline'): { imageName: string; imagePath: string } {
12-
const imageName = `${Date.now()}.${type}.png`;
13+
const imageName = `${uuidAPIKey.create({ noDashes: true }).apiKey}.${type}.png`;
1314
return {
1415
imageName,
1516
imagePath: this.getImagePath(imageName),

0 commit comments

Comments
 (0)