Review main Merged

81111[BUGFIX] Handle missing image dimensions gracefully

Nikita Hovratov CR +2 V +2 Easy +39 −3 updated 09/20/23, 19:49

Commit message

Just like SvgImageProcessor, DeferredBackendImageProcessor now also
catches the exception, which is thrown, when image dimensions equal
zero and falls back to 64x64 image dimension. This enables editors to
correct bad image cropping without the need to do it in the database.

To be more specific, a new Exception ZeroImageDimensionException is
added, which is used in both processors now.

The image cropping editor is already fixed to only allow a minimum
dimension of 10x10. However, already corrupted files can not be
accessed without this patch.

Review

  • Code review CR +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
  • Verified V +2 Done
    • Stefan Bürk +2
    • Oliver Klee +1
    • core-ci +1 CI

Issues 2

Files 4

Review log 1518

  1. Nikita Hovratov uploaded patch set 1 09/20/23, 14:37

  2. Oliver Klee voted on patch set 1 CR +1 09/20/23, 14:40

  3. Andreas Kienast voted on patch set 1 CR +1 09/20/23, 14:44

  4. Oli Bartsch commented on patch set 1 09/20/23, 14:51

    DeferredBackendImageProcessor.php:53

    Any chance to be more specific here?
  5. core-ci voted on patch set 1 V +1 09/20/23, 14:51 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46901

  6. Nikita Hovratov uploaded patch set 2 CR +1 V +1 09/20/23, 15:24

  7. Nikita Hovratov commented on patch set 2 09/20/23, 15:26

    DeferredBackendImageProcessor.php:53 Reply

    Added a new custom Exception to be used in both processors.
  8. Oliver Klee commented on patch set 2 09/20/23, 15:28

    ZeroImageDimensionException.php:23

    Nitpick: There should be no comma.

    ZeroImageDimensionException.php:26

    Maybe make it `final`?

    SvgImageProcessor.php:47

    `$e` is not needed here (only for the backports).
  9. core-ci voted on patch set 2 V +1 09/20/23, 15:32 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46911

  10. Nikita Hovratov commented on patch set 2 09/20/23, 15:38

    ZeroImageDimensionException.php:26 Reply

    Not sure if this is really needed. Should be done for all Exceptions then, or?

    SvgImageProcessor.php:47 Reply

    I kept it for easier backports, yes. As long as we do not enforce omitting the variable, this does not hurt.
  11. Nikita Hovratov uploaded patch set 3 V +1 09/20/23, 15:38

  12. Nikita Hovratov commented on patch set 2 09/20/23, 15:38

    ZeroImageDimensionException.php:26 Reply

    Done
  13. Oliver Klee commented on patch set 3 V +1 CR +1 09/20/23, 15:40

    SvgImageProcessor.php:47 Reply

    Ack
  14. Oliver Klee commented on patch set 3 09/20/23, 15:40

    ZeroImageDimensionException.php:23 Reply

    Done
  15. Stefan Bürk commented on patch set 3 V +1 CR +1 09/20/23, 15:44

    SvgImageProcessor.php:47 Reply

    Could have been $_ do emphasize it and having easier backport. However, ok for now.
  16. core-ci voted on patch set 3 V +1 09/20/23, 15:45 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/46912

  17. Stefan Bürk voted on patch set 3 V +2 CR +2 09/20/23, 19:35

  18. Stefan Bürk merged patch set 4 09/20/23, 19:49