change regex names

This commit is contained in:
rubikscraft
2022-04-16 17:09:01 +02:00
parent 9dd199a4e3
commit ff07ee94c6
8 changed files with 18 additions and 17 deletions

View File

@@ -4,13 +4,13 @@ import {
Injectable,
PipeTransform
} from '@nestjs/common';
import { SHA256 } from 'picsur-shared/dist/util/common-regex';
import { SHA256Regex } from 'picsur-shared/dist/util/common-regex';
@Injectable()
export class ImageIdValidator implements PipeTransform<string, string> {
transform(value: string, metadata: ArgumentMetadata): string {
// Check regex for sha256
if (SHA256.test(value)) return value;
if (SHA256Regex.test(value)) return value;
throw new BadRequestException('Invalid image id');
}
}