Commit 6cb39a11 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Correction suppression à tort du fichier retraité + interception erreur...

Correction suppression à tort du fichier retraité + interception erreur imagick lors de la création de l'aperçu de la 1ere page.
parent 57e63913
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -643,7 +643,7 @@ class TheseController extends AbstractController
                    // erreur prévue
                }
            }
            return $this->redirect()->refresh();
            return $this->redirect()->toRoute(null, [], [], true);
        }

        $theseRetraiteeAutoListUrl = $this->urlFichierThese()->listerFichiers(
+5 −2
Original line number Diff line number Diff line
@@ -494,6 +494,7 @@ class FichierService extends BaseService
        $inputFilePath = $this->computeDestinationFilePathForFichier($fichier);
        $outputFilePath = sys_get_temp_dir() . '/' . uniqid($fichier->getNom() . '-') . '.png';

        try {
            $im = new \Imagick();
            $im->setResolution(300, 300);
            $im->readImage($inputFilePath . '[0]'); // 1ere page seulement
@@ -501,11 +502,13 @@ class FichierService extends BaseService
            $im->writeImage($outputFilePath);
            $im->clear();
            $im->destroy();
        } catch (\ImagickException $ie) {
            throw new RuntimeException(
                "Erreur rencontrée lors de la création de l'aperçu", null, $ie);
        }

        $content = file_get_contents($outputFilePath);

        unlink($outputFilePath);

        return $content;
    }

+0 −3
Original line number Diff line number Diff line
@@ -66,9 +66,6 @@ class RetraitementService
            throw $toce;
        }
        catch (RuntimeException $rte) {
            // suppression du fichier d'entrée sur le disque
            unlink($inputFilePath);

            throw new RuntimeException(
                "Une erreur est survenue lors de l'exécution de la commande de retraitement " . $this->command->getName(),
                0,