Convert in GoogleSitemapController to int, avoid 500 errors on non-nomeric values

This commit is contained in:
Jan Metzger 2022-07-28 12:28:58 +02:00
parent cb56ac11d9
commit 0e965ecd46

View File

@ -68,11 +68,11 @@ class GoogleSitemapController extends Controller
public function sitemap() public function sitemap()
{ {
$class = $this->unsanitiseClassName($this->request->param('ID')); $class = $this->unsanitiseClassName($this->request->param('ID'));
$page = $this->request->param('OtherID'); $page = intval($this->request->param('OtherID'));
if (GoogleSitemap::enabled() if (GoogleSitemap::enabled()
&& $class && $class
&& $page && ($page > 0)
&& ($class == SiteTree::class || $class == 'GoogleSitemapRoute' || GoogleSitemap::is_registered($class)) && ($class == SiteTree::class || $class == 'GoogleSitemapRoute' || GoogleSitemap::is_registered($class))
) { ) {
$this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"'); $this->getResponse()->addHeader('Content-Type', 'application/xml; charset="utf-8"');