| 465 | repo_id = IntegerField(_l("Repo ID"), validators=[DataRequired()]) |
| 466 | |
| 467 | def validate_avatar(self, field): |
| 468 | if field.data: |
| 469 | if field.data.content_type not in [ |
| 470 | "image/jpeg", |
| 471 | "image/png", |
| 472 | "image/gif", |
| 473 | "image/webp", |
| 474 | ]: |
| 475 | raise ValidationError( |
| 476 | _( |
| 477 | "Invalid file type. Only JPEG, PNG, GIF and WebP images are allowed." |
| 478 | ) |
| 479 | ) |
| 480 | if field.data.size > 10 * 1024 * 1024: # 10MB |
| 481 | raise ValidationError( |
| 482 | _("File size exceeds the maximum allowed (10MB).") |
| 483 | ) |
| 484 | |
| 485 | def __init__(self, *args, db: AsyncSession, team: Team, project: Project, **kwargs): |
| 486 | super().__init__(*args, **kwargs) |