ext-solr
ext-solr copied to clipboard
[BUG] SolrRoutingMiddleware does not work when using route enhancer on root page
Describe the bug I have a PageType route enhancer and map a PageType to the suffix menu.json like so:
routeEnhancers:
PageTypeSuffix:
type: PageType
default: ''
map:
menu.json: 50003
This works as expected for every page but the root page. On the root page the extension loggs
Could not resolve page by path "menu.json" and language "de"
The problem seems to be revolving around how retrievePageInformation
splits the URL and then wrongly comes to the conclusion that the page does not exist.
To Reproduce Steps to reproduce the behavior:
- Define a PageTypeSuffix route enhancer and use it on the root page
Expected behavior The Middleware should detect the root page in the middleware and not log an error
Used versions (please complete the following information):
- TYPO3 Version: 10.4.24
- Browser: N/A
- EXT:solr Version: 11.1.3 (however code is the same on master)
- Used Apache Solr Version: N/A
- PHP Version: 7.4
- MySQL Version: N/A
@EmanuelOster
Thanks for reporting that issue.
Could you provide a pull-request or point to the exact trouble-place in code?
The SolrRoutingMiddleware::retrievePageInformation()
is about 70 rows, which of them makes the trouble?
Hello @dkd-kaehm,
the trouble-place is Line 330 } elseif (empty($path)) {
If you call a page like demo.org/de/robots.txt or demo.org/de/sitemap.xml, the path for the first loop is /robots.txt and for the second empty, because it's the rootpage. This should not log an error.