1
0
Fork 0
mirror of https://github.com/Chocobozzz/PeerTube.git synced 2025-10-05 19:42:24 +02:00

Trim video name also on server

This commit is contained in:
Chocobozzz 2021-02-25 10:01:33 +01:00
parent 56b0a516f2
commit 0221f8c9b1
No known key found for this signature in database
GPG key ID: 583A612D890159BE
2 changed files with 7 additions and 6 deletions

View file

@ -3,15 +3,14 @@ import { BuildFormValidator } from './form-validator.model'
export const trimValidator: ValidatorFn = (control: FormControl) => {
if (control.value.startsWith(' ') || control.value.endsWith(' ')) {
return {
'spaces': true
}
return { spaces: true }
}
return null;
};
return null
}
export const VIDEO_NAME_VALIDATOR: BuildFormValidator = {
VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120), trimValidator ],
VALIDATORS: [ Validators.required, Validators.minLength(3), Validators.maxLength(120) ],
MESSAGES: {
'required': $localize`Video name is required.`,
'minlength': $localize`Video name must be at least 3 characters long.`,