thumb: ensure exception message in X-Error header
authorMischa POSLAWSKY <perl@shiar.org>
Fri, 12 Jul 2019 00:28:47 +0000 (02:28 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Fri, 12 Jul 2019 02:18:16 +0000 (04:18 +0200)
Multiline convert warnings would be ignored; the first line should suffice.
Include the expected header regardless of fallback output.

thumb/index.php

index 24f46ccb97ab44ea5125c48d63dc18a03283d4bd..27a194ee51584f5840c42eff880207e02e6a42da 100644 (file)
@@ -17,9 +17,9 @@ try {
 }
 catch (Throwable $e) {
        http_response_code($e->getCode() ?: 500);
+       header("X-Error: ".explode("\n", $e->getMessage())[0], FALSE);
        $target = '500.png';
        if (file_exists($target)) {
-               header("X-Error: ".$e->getMessage());
                header('Content-type: '.mime_content_type($target));
                readfile($target);
                exit;