mirror of
https://github.com/CaramelFur/Picsur.git
synced 2025-11-15 07:55:49 +01:00
change regex names
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user