From d31a85fc04187abd7ebbc09f7929adc0e20db6f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dalibor=20Karlovi=C4=87?= Date: Mon, 11 Dec 2023 15:44:07 +0100 Subject: [PATCH] fix: correctly compress sitemap.xml --- src/Generator.php | 2 +- .../site/fixtures/sitemap-article-0.xml.gz | Bin 220 -> 238 bytes .../site/fixtures/sitemap-articles-0.xml.gz | Bin 179 -> 197 bytes .../site/fixtures/sitemap-file-0.xml.gz | Bin 184 -> 202 bytes .../site/fixtures/sitemap-homepage-0.xml.gz | Bin 174 -> 192 bytes .../site/fixtures/sitemap-index-0.xml.gz | Bin 158 -> 176 bytes .../site/fixtures/sitemap-product-0.xml.gz | Bin 181 -> 199 bytes .../sitemap-product_with_route_default-0.xml.gz | Bin 177 -> 195 bytes tests/functional/site/fixtures/sitemap.xml.gz | Bin 278 -> 296 bytes 9 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Generator.php b/src/Generator.php index afb7be7..915bcb4 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -167,7 +167,7 @@ private function dumpSitemap(Sitemapindex|Urlset $sitemap, bool $deflate): void } /** @var string $content */ - $content = $deflate ? gzdeflate($sitemap->toXml()) : $sitemap->toXml(); + $content = ($deflate ? gzencode($sitemap->toXml()) : $sitemap->toXml()); $this->filesystem->dumpFile($this->buildDir.str_replace($this->generateUrl(''), '', $path), $content); } } diff --git a/tests/functional/site/fixtures/sitemap-article-0.xml.gz b/tests/functional/site/fixtures/sitemap-article-0.xml.gz index ec1bbc958fa1d00149aba6a0063db6ab9c8276d5..d6119a0440bcc73b57446f96e198732645df4ee7 100644 GIT binary patch delta 26 ecmcb^_>PfFzMF#q445a};pmYoKjY8LzyJVPJ_bJk delta 7 OcmaFIc!zN!*Bt;2f&)YV diff --git a/tests/functional/site/fixtures/sitemap-articles-0.xml.gz b/tests/functional/site/fixtures/sitemap-articles-0.xml.gz index adfa6555c2bd7df0090086640ad35e76b4369418..7d4b6b4db626408640f2bc44d61618ed6b1890b6 100644 GIT binary patch delta 26 ecmdnYc$AS#zMF#q445Zu=I}T=fA0xK1_l6AmIk)~ delta 7 OcmX@gxS4Sx*Jc0aZ+4**ig2MquK delta 7 OcmdnMIFE56*E|3UTmp&! diff --git a/tests/functional/site/fixtures/sitemap-product-0.xml.gz b/tests/functional/site/fixtures/sitemap-product-0.xml.gz index d017319059cb19a5f155fbb94f1e10e7888c008a..41c57bedd6a8803b27f57ed2c6abb73556f71e3e 100644 GIT binary patch delta 26 ecmdnWc$|?-zMF#q445Zu<>)^rv*83I0|Nk4G6sDB delta 7 OcmX@kxRr4t*H!=vhXT(4 diff --git a/tests/functional/site/fixtures/sitemap-product_with_route_default-0.xml.gz b/tests/functional/site/fixtures/sitemap-product_with_route_default-0.xml.gz index 9935ea5ba6e91296bc54dbcd83d3bab9bf5a2554..e870252ffaf8528617382a6797f44121d0006df6 100644 GIT binary patch delta 26 dcmdnUc$kq(zMF#q445Zufm20{~FD24nyL delta 7 OcmX@ixRG%p*G2#fQv$;P diff --git a/tests/functional/site/fixtures/sitemap.xml.gz b/tests/functional/site/fixtures/sitemap.xml.gz index 746706daa168b2d8275e3fcf2895136568b93616..66662fabc544dae7f26535e3d24375ca803cef9d 100644 GIT binary patch delta 27 fcmbQnw1SCCzMF#q445~FF>+M$#UFUY!oUCkN3#W8 delta 8 PcmZ3%G>vH^mlz`e3-baM