Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[QA - Sentry] Les fichiers de format ne sont pas pris en charge #3612

Merged
merged 3 commits into from
Jan 28, 2025

Conversation

hmeneuvrier
Copy link
Collaborator

Ticket

#3336

Description

J'ai fait le tour des erreurs sentry de ce type des 30 derniers jours.
Il y avait 2 cas possibles :

  • un type de fichier non supporté, mais le format n'est pas dans l'erreur
  • un fichier vide, et la taille n'était pas vérifié avant de vérifier le format

Changements apportés

  • Amélioration du message d'erreur en cas de format non supporté
  • Vérificcation de la taille du fichcier avant de vérifier le format

Pré-requis

Désacctiver la vérification js

Tests

  • Essayer d'uploader un document avec cun format non supporté, vérifier le message d'erreur
  • Essayer d'uploader un fichier vide, vérifier le message d'erreur

$acceptedExtensions = UploadHandlerService::getAcceptedExtensions('photo');
$message = <<<ERROR
$fileInfo = ' ( Fichier : '.$file->__toString().' MimeType : '.$file->getMimeType().' )';
$this->logger->error($message.$fileInfo);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

J'enlèverais bien aussi les logs sur sentry pour des formats non supportés... non ?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je suis ok, mais y'avait peut-être une raison derrière ça ?

if (\in_array($file->getMimeType(), File::IMAGE_MIME_TYPES)) {
$this->imageManipulationHandler->setUseTmpDir(false)->resize($filename)->thumbnail($filename);
$fileInfo = ' ( Fichier : '.$file->__toString().' MimeType : '.$file->getMimeType().' )';
$this->logger->error($message.$fileInfo);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

idem

@hmeneuvrier hmeneuvrier force-pushed the bugfix/3336-qa---sentry-check-size-format-type branch from c8b5dcb to 6c34f91 Compare January 24, 2025 15:45
Copy link
Collaborator

@emilschn emilschn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lecture et tests ok

@emilschn emilschn merged commit c4320eb into develop Jan 28, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants