mirror of
https://github.com/strapi/strapi.git
synced 2026-01-06 12:13:52 +00:00
throw error when public folder could not be created
This commit is contained in:
parent
6e17361e32
commit
e28cdc8a4a
10
packages/core/strapi/lib/core/bootstrap.js
vendored
10
packages/core/strapi/lib/core/bootstrap.js
vendored
@ -3,7 +3,7 @@
|
||||
const { getConfigUrls } = require('@strapi/utils');
|
||||
const fse = require('fs-extra');
|
||||
|
||||
module.exports = function({ strapi }) {
|
||||
module.exports = async function({ strapi }) {
|
||||
strapi.config.port = strapi.config.get('server.port') || strapi.config.port;
|
||||
strapi.config.host = strapi.config.get('server.host') || strapi.config.host;
|
||||
|
||||
@ -25,5 +25,11 @@ module.exports = function({ strapi }) {
|
||||
}
|
||||
|
||||
// ensure public repository exists
|
||||
fse.ensureDir(strapi.dirs.public);
|
||||
try {
|
||||
await fse.ensureDir(strapi.dirs.public);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`The public folder (${strapi.dirs.public}) doesn't exist. Please make sure it exists.`
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
@ -22,7 +22,13 @@ module.exports = {
|
||||
|
||||
// Ensure uploads folder exists
|
||||
const uploadPath = path.resolve(strapi.dirs.public, UPLOADS_FOLDER_NAME);
|
||||
fse.ensureDirSync(uploadPath);
|
||||
try {
|
||||
fse.ensureDirSync(uploadPath);
|
||||
} catch (e) {
|
||||
throw new Error(
|
||||
`The upload folder (${uploadPath}) doesn't exist. Please make sure it exists.`
|
||||
);
|
||||
}
|
||||
|
||||
return {
|
||||
upload(file) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user