From 6dd821bd418e26242ba95510c8a373020989143a Mon Sep 17 00:00:00 2001 From: Daniel Lockyer Date: Mon, 14 Oct 2024 16:09:50 +0200 Subject: [PATCH] Fixed setting minification ready state upon failure (#21294) - this will prevent the `ready` variable from being set to true if there is an error with minification, as we have not correctly generated the assets yet --- .../assets-minification/AssetsMinificationBase.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ghost/core/core/frontend/services/assets-minification/AssetsMinificationBase.js b/ghost/core/core/frontend/services/assets-minification/AssetsMinificationBase.js index 7a9d8b8cde..8637b06457 100644 --- a/ghost/core/core/frontend/services/assets-minification/AssetsMinificationBase.js +++ b/ghost/core/core/frontend/services/assets-minification/AssetsMinificationBase.js @@ -48,16 +48,16 @@ module.exports = class AssetsMinificationBase { async minify(globs, options) { try { - return await this.minifier.minify(globs, options); + const result = await this.minifier.minify(globs, options); + this.ready = true; + return result; } catch (error) { if (error.code === 'EACCES') { logging.error('Ghost was not able to write asset files due to permissions.'); return; } - throw error; - } finally { - this.ready = true; + throw error; } }