ethercreative/seo

Sitemap is being generated with leading spaces causing invalid XML

lopugit opened this issue · 2 comments

Description

sitemap.xml file is being generated with spaces at the start of the file making it an invalid XML document.

Visit https://sport.unimelb.edu.au/sitemap.xml to see, and view source

Steps to reproduce

  1. Install SEO plugin
  2. Generate sitemap

Additional info

  • Craft version: 3.7.46
  • SEO version: 3.7.4
  • PHP version: 8.0.18
  • Database driver & version:
  • Other Plugins:

I've investigated this a bit and found that no matter what $response->content is set to in XmlController.php it always adds spaces at the start of the XML response. Is this an issue with \Craft::$app->getResponse(); ?

Turned out to be some leading spaces added before a <?php tag in the routes file