]> git.agnieray.net Git - galette.git/commitdiff
Allow sourc emap files for plugins, rework failure
authorJohan Cwiklinski <johan@x-tnd.be>
Sun, 5 Mar 2023 09:24:39 +0000 (10:24 +0100)
committerJohan Cwiklinski <johan@x-tnd.be>
Sun, 5 Mar 2023 09:24:39 +0000 (10:24 +0100)
galette/includes/routes/plugins.routes.php

index 60c71582eb79b6a4a0abaed2bbce5a99c6ddbaac..cc48f4e1d2019c6940f6c75a2823d0556f7bc268 100644 (file)
@@ -56,7 +56,8 @@ $app->group(
                     'jpg'   => 'image/jpg',
                     'jpeg'  => 'image/jpg',
                     'gif'   => 'image/gif',
-                    'svg'   => 'image/svg+xml'
+                    'svg'   => 'image/svg+xml',
+                    'map'   => 'application/json'
                 ];
                 if (strpos($path, '../') === false && isset($auth_ext[$ext])) {
                     $file = $container->get('plugins')->getFile(
@@ -70,9 +71,13 @@ $app->group(
                     $body->write(file_get_contents($file));
                     return $response;
                 } else {
-                    $this->halt(
-                        500,
-                        _T("Invalid extension!")
+                    throw new \RuntimeException(
+                        sprintf(
+                            'Invalid extension %1$s (%2$s)!',
+                            $ext,
+                            $path
+                        ),
+                        404
                     );
                 }
             }