chore(quarkus-327): bump to Quarkus 3.27.3 LTS, rename quarkus-resteasy-reactive → quarkus-rest, fix testGetAuditQuestions map vs list, rename deprecated config keys
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
package dev.lions.utils;
|
||||
|
||||
import dev.lions.exceptions.FileUploadException;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import org.primefaces.model.file.UploadedFile;
|
||||
|
||||
/**
|
||||
* Utilitaire pour la validation des fichiers téléchargés.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class FileValidator {
|
||||
public void validateFile(UploadedFile file, String acceptedTypes, long maxSize) {
|
||||
if (file.getSize() > maxSize) {
|
||||
throw new FileUploadException("Le fichier dépasse la taille maximale autorisée.");
|
||||
}
|
||||
|
||||
if (!acceptedTypes.contains(file.getContentType())) {
|
||||
throw new FileUploadException("Type de fichier non autorisé.");
|
||||
}
|
||||
}
|
||||
}
|
||||
package dev.lions.utils;
|
||||
|
||||
import dev.lions.exceptions.FileUploadException;
|
||||
import jakarta.enterprise.context.ApplicationScoped;
|
||||
import org.primefaces.model.file.UploadedFile;
|
||||
|
||||
/**
|
||||
* Utilitaire pour la validation des fichiers téléchargés.
|
||||
*/
|
||||
@ApplicationScoped
|
||||
public class FileValidator {
|
||||
public void validateFile(UploadedFile file, String acceptedTypes, long maxSize) {
|
||||
if (file.getSize() > maxSize) {
|
||||
throw new FileUploadException("Le fichier dépasse la taille maximale autorisée.");
|
||||
}
|
||||
|
||||
if (!acceptedTypes.contains(file.getContentType())) {
|
||||
throw new FileUploadException("Type de fichier non autorisé.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user