mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-23 22:11:09 +03:00
🐛 Ensured directory exists before attempting write
- Currently, nothing happens if the file doesn't exist, the error is swallowed - This module should ensure the directory exists at the point of write, else Ghost has to do too much - TODO: improve the testing and error handling here as well
This commit is contained in:
parent
78559033cd
commit
0ffeee6712
@ -101,6 +101,9 @@ class Minifier {
|
||||
async writeFile(contents, dest) {
|
||||
if (contents) {
|
||||
let writePath = this.getFullDest(dest);
|
||||
// Ensure the output folder exists
|
||||
await fs.mkdir(this.destPath, {recursive: true});
|
||||
// Create the file
|
||||
await fs.writeFile(writePath, contents);
|
||||
return writePath;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user