Skip to content
Snippets Groups Projects
Commit 5c296a45 authored by linawolf's avatar linawolf Committed by Benjamin Franzke
Browse files

[BUGFIX] Prevent type error on static route

If you happen to have inconsistent data in the
config.yaml like:

```
routes:
  -
    route: robots.txt
    type: staticText
    source: 'EXT:my_sitepackage_mysite/Resources/Public/robots.txt'
```

Currently a PHP type error is thrown instead of a proper exception.

Resolves: #102773
Releases: main, 12.4
Change-Id: If16a93b851237c9d39893cd3e56fa9693986721d
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/82478


Tested-by: default avatarBenjamin Franzke <ben@bnf.dev>
Tested-by: default avatarcore-ci <typo3@b13.com>
Reviewed-by: default avatarBenjamin Franzke <ben@bnf.dev>
parent 9fcbdad4
Branches
Tags
No related merge requests found
......@@ -139,6 +139,9 @@ class StaticRouteResolver implements MiddlewareInterface
{
switch ($type) {
case 'staticText':
if (!isset($routeConfig['content']) || !is_string($routeConfig['content'])) {
throw new \InvalidArgumentException('A static route of type "staticText" must have a content defined.', 1704704705);
}
$content = $routeConfig['content'];
$contentType = 'text/plain; charset=utf-8';
break;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment