Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Add v3.41.8
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickRe committed Feb 23, 2021
1 parent c36afbb commit 45564c9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 6 deletions.
16 changes: 16 additions & 0 deletions core/frontend/services/themes/Storage.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ module.exports = {
}

let checkedTheme;
let renamedExisting = false;

return validate.checkSafe(zip, true)
.then((_checkedTheme) => {
Expand All @@ -58,6 +59,7 @@ module.exports = {
.then((themeExists) => {
// CASE: move the existing theme to a backup folder
if (themeExists) {
renamedExisting = true;
return getStorage().rename(shortName, backupName);
}
})
Expand Down Expand Up @@ -86,6 +88,20 @@ module.exports = {
theme: toJSON(shortName, checkedTheme)
};
})
.catch((error) => {
// restore backup if we renamed an existing theme but saving failed
if (renamedExisting) {
return getStorage().exists(shortName).then((themeExists) => {
if (!themeExists) {
return getStorage().rename(backupName, shortName).then(() => {
throw error;
});
}
});
}

throw error;
})
.finally(() => {
// @TODO: we should probably do this as part of saving the theme
// CASE: remove extracted dir from gscan happens in background
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ghost",
"version": "3.41.7",
"version": "3.41.8",
"description": "The professional publishing platform",
"author": "Ghost Foundation",
"homepage": "https://ghost.org",
Expand Down Expand Up @@ -56,7 +56,7 @@
"@tryghost/kg-markdown-html-renderer": "3.0.0",
"@tryghost/kg-mobiledoc-html-renderer": "3.0.1",
"@tryghost/magic-link": "0.6.4",
"@tryghost/members-api": "0.37.10",
"@tryghost/members-api": "0.37.11",
"@tryghost/members-csv": "0.4.2",
"@tryghost/members-ssr": "0.8.8",
"@tryghost/mw-session-from-token": "0.1.14",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -553,10 +553,10 @@
jsonwebtoken "^8.5.1"
lodash "^4.17.15"

"@tryghost/members-api@0.37.10":
version "0.37.10"
resolved "https://registry.yarnpkg.com/@tryghost/members-api/-/members-api-0.37.10.tgz#73fedfdba1c060109a6df84a5e96a4b4a717e5d4"
integrity sha512-Q4rdNmaouNk3YBv02yUelzL+ETPiGkWGfeuBcw6bcMTOtp4GbsT1MUWxRY8pK50EZJjL1+4+Fj8QlmiCtpfTdQ==
"@tryghost/members-api@0.37.11":
version "0.37.11"
resolved "https://registry.yarnpkg.com/@tryghost/members-api/-/members-api-0.37.11.tgz#a66aa63c04236f2a5fce207567746bf91fb0d59c"
integrity sha512-LMaE1XPDru7kysrFwZ48/gtL2OMVlPUK4DEjLL1ys7seQTKm6ljhalc40rl7zBkvg1nh+br0qcikMSTpng2vzA==
dependencies:
"@tryghost/magic-link" "^0.6.7"
bluebird "^3.5.4"
Expand Down

0 comments on commit 45564c9

Please sign in to comment.