From 9e96410a9882c5e21bc2a58b3d935708aa7d2efc Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Thu, 6 Apr 2023 18:11:49 +0300 Subject: [PATCH 1/6] fix --- src/express-middleware/sitemap.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/express-middleware/sitemap.js b/src/express-middleware/sitemap.js index 6525b540af..9208c5abff 100644 --- a/src/express-middleware/sitemap.js +++ b/src/express-middleware/sitemap.js @@ -5,7 +5,7 @@ export const sitemap = function (req, res, next) { generateSitemap(req).then((sitemap) => { if (Buffer.isBuffer(sitemap)) { res.set('Content-Type', 'application/x-gzip'); - res.set('Content-Encoding', 'gzip'); + res.set('Content-Encoding', 'gz'); res.set('Content-Disposition', 'attachment; filename="sitemap.xml.gz"'); res.send(sitemap); } else { From e1762b4999c43cb5bcc87e007b9c6cb26a669adb Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Thu, 6 Apr 2023 18:24:23 +0300 Subject: [PATCH 2/6] changelog --- news/4661.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 news/4661.bugfix diff --git a/news/4661.bugfix b/news/4661.bugfix new file mode 100644 index 0000000000..61d1470792 --- /dev/null +++ b/news/4661.bugfix @@ -0,0 +1 @@ +fix sitemap.xml.gz not is not compressed @dobri1408 \ No newline at end of file From a3dced910603fda1851dec40aac727561dc76e73 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Thu, 6 Apr 2023 18:24:50 +0300 Subject: [PATCH 3/6] changelog --- news/4661.bugfix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/news/4661.bugfix b/news/4661.bugfix index 61d1470792..708a1987dc 100644 --- a/news/4661.bugfix +++ b/news/4661.bugfix @@ -1 +1 @@ -fix sitemap.xml.gz not is not compressed @dobri1408 \ No newline at end of file +fix sitemap.xml.gz not is not compressed @dobri1408 From 0876701547bcba0511709ec294e379d70562b252 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Fri, 7 Apr 2023 21:00:51 +0300 Subject: [PATCH 4/6] valid content --- package.json | 1 + packages/generator-volto/yarn.lock | 2 +- src/express-middleware/sitemap.js | 2 +- src/helpers/Sitemap/Sitemap.js | 1 + yarn.lock | 10 ++++++++++ 5 files changed, 14 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index ccc3202d9c..1276724265 100644 --- a/package.json +++ b/package.json @@ -251,6 +251,7 @@ "babel-plugin-react-intl": "5.1.17", "babel-plugin-root-import": "6.1.0", "babel-preset-razzle": "4.2.17", + "base64": "2.1.0", "bundlewatch": "0.2.7", "circular-dependency-plugin": "5.2.2", "classnames": "2.2.6", diff --git a/packages/generator-volto/yarn.lock b/packages/generator-volto/yarn.lock index c53534dc9f..b8c68d885b 100644 --- a/packages/generator-volto/yarn.lock +++ b/packages/generator-volto/yarn.lock @@ -6367,7 +6367,7 @@ __metadata: "minizlib@npm:^2.1.1, minizlib@npm:^2.1.2": version: 2.1.2 - resolution: "minizlib@npm:2.1.2" + resolution: "mini@npm:2.1.2" dependencies: minipass: ^3.0.0 yallist: ^4.0.0 diff --git a/src/express-middleware/sitemap.js b/src/express-middleware/sitemap.js index 9208c5abff..dcfbc7962d 100644 --- a/src/express-middleware/sitemap.js +++ b/src/express-middleware/sitemap.js @@ -5,7 +5,7 @@ export const sitemap = function (req, res, next) { generateSitemap(req).then((sitemap) => { if (Buffer.isBuffer(sitemap)) { res.set('Content-Type', 'application/x-gzip'); - res.set('Content-Encoding', 'gz'); + res.set('Content-Encoding', 'compress'); res.set('Content-Disposition', 'attachment; filename="sitemap.xml.gz"'); res.send(sitemap); } else { diff --git a/src/helpers/Sitemap/Sitemap.js b/src/helpers/Sitemap/Sitemap.js index ac2629e61f..906ba98391 100644 --- a/src/helpers/Sitemap/Sitemap.js +++ b/src/helpers/Sitemap/Sitemap.js @@ -44,6 +44,7 @@ export const generateSitemap = (_req) => const result = `\n\n${items.join( '\n', )}\n`; + zlib.gzip(Buffer.from(result, 'utf8'), (_err, buffer) => { resolve(buffer); }); diff --git a/yarn.lock b/yarn.lock index f5aa1197cb..825de0435e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2651,6 +2651,7 @@ __metadata: babel-plugin-react-intl: 5.1.17 babel-plugin-root-import: 6.1.0 babel-preset-razzle: 4.2.17 + base64: 2.1.0 bundlewatch: 0.2.7 circular-dependency-plugin: 5.2.2 classnames: 2.2.6 @@ -6628,6 +6629,15 @@ __metadata: languageName: node linkType: hard +"base64@npm:2.1.0": + version: 2.1.0 + resolution: "base64@npm:2.1.0" + dependencies: + node-gyp: latest + checksum: 436246dc8ff6e2a7372f8636592db14587726317dda35252590976f27450c64436c36fb39c854848662591f457a0cb62ba0f0da929f50912613a884ccdd2bec3 + languageName: node + linkType: hard + "base@npm:^0.11.1": version: 0.11.2 resolution: "base@npm:0.11.2" From aeaf53a6c0c838a5a418dad899996efd585bbbbb Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Fri, 7 Apr 2023 21:03:50 +0300 Subject: [PATCH 5/6] working version --- package.json | 1 - packages/generator-volto/yarn.lock | 2 +- src/helpers/Sitemap/Sitemap.js | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/package.json b/package.json index 1276724265..ccc3202d9c 100644 --- a/package.json +++ b/package.json @@ -251,7 +251,6 @@ "babel-plugin-react-intl": "5.1.17", "babel-plugin-root-import": "6.1.0", "babel-preset-razzle": "4.2.17", - "base64": "2.1.0", "bundlewatch": "0.2.7", "circular-dependency-plugin": "5.2.2", "classnames": "2.2.6", diff --git a/packages/generator-volto/yarn.lock b/packages/generator-volto/yarn.lock index b8c68d885b..c53534dc9f 100644 --- a/packages/generator-volto/yarn.lock +++ b/packages/generator-volto/yarn.lock @@ -6367,7 +6367,7 @@ __metadata: "minizlib@npm:^2.1.1, minizlib@npm:^2.1.2": version: 2.1.2 - resolution: "mini@npm:2.1.2" + resolution: "minizlib@npm:2.1.2" dependencies: minipass: ^3.0.0 yallist: ^4.0.0 diff --git a/src/helpers/Sitemap/Sitemap.js b/src/helpers/Sitemap/Sitemap.js index 906ba98391..ac2629e61f 100644 --- a/src/helpers/Sitemap/Sitemap.js +++ b/src/helpers/Sitemap/Sitemap.js @@ -44,7 +44,6 @@ export const generateSitemap = (_req) => const result = `\n\n${items.join( '\n', )}\n`; - zlib.gzip(Buffer.from(result, 'utf8'), (_err, buffer) => { resolve(buffer); }); From a59e56eacd6628c0c526b9e4e619d4bc62492c73 Mon Sep 17 00:00:00 2001 From: Dobricean Ioan Dorian Date: Fri, 7 Apr 2023 21:04:53 +0300 Subject: [PATCH 6/6] working version --- yarn.lock | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/yarn.lock b/yarn.lock index 825de0435e..36ef420dde 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2651,7 +2651,6 @@ __metadata: babel-plugin-react-intl: 5.1.17 babel-plugin-root-import: 6.1.0 babel-preset-razzle: 4.2.17 - base64: 2.1.0 bundlewatch: 0.2.7 circular-dependency-plugin: 5.2.2 classnames: 2.2.6 @@ -6629,15 +6628,6 @@ __metadata: languageName: node linkType: hard -"base64@npm:2.1.0": - version: 2.1.0 - resolution: "base64@npm:2.1.0" - dependencies: - node-gyp: latest - checksum: 436246dc8ff6e2a7372f8636592db14587726317dda35252590976f27450c64436c36fb39c854848662591f457a0cb62ba0f0da929f50912613a884ccdd2bec3 - languageName: node - linkType: hard - "base@npm:^0.11.1": version: 0.11.2 resolution: "base@npm:0.11.2" @@ -19863,7 +19853,7 @@ __metadata: dependencies: prop-types: ^15.7.2 peerDependencies: - react-intl: ^2.2.2 || ^3.0.0 + react-intl: ^2.2.2 || ^3.0.0 react-redux: ^5.0.1 || ^6.0.0 || ^7.0.0 checksum: eece9837c7b97581961732168b2e286e771ad4104bdde94caf3ce61ef51d8daa64b4365d4353901029a0cfa91c411a5149ff8bf0a89ac94eebce93982e1cb0f4 languageName: node @@ -25456,4 +25446,4 @@ __metadata: resolution: "zwitch@npm:1.0.5" checksum: 28a1bebacab3bc60150b6b0a2ba1db2ad033f068e81f05e4892ec0ea13ae63f5d140a1d692062ac0657840c8da076f35b94433b5f1c329d7803b247de80f064a languageName: node - linkType: hard + linkType: hard \ No newline at end of file