mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-28 05:14:12 +03:00
Fixed error logged for absent redirects config
refs #11085 - Incorrect usage error was logged to the output when there was no recirecst configuration file present in the system. Previously an empty string was returned in such situation, resulting in "ENOENT" error, which was ignored through special handling. - The fix resembles logic in redirects async getter function where empty array is returned when the config file does not exits. - Attempting to read unexistent config should not ever happen and will be handled on the config service layer, this is why special "ENOENT" handling has been removed
This commit is contained in:
parent
142f5d389d
commit
f69526c140
@ -191,6 +191,11 @@ const get = () => {
|
||||
|
||||
const loadRedirectsFile = () => {
|
||||
const filePath = getCurrentRedirectsFilePathSync();
|
||||
|
||||
if (filePath === null) {
|
||||
return defaultJsonFileContent;
|
||||
}
|
||||
|
||||
const content = fs.readFileSync(filePath);
|
||||
|
||||
return parseRedirectsFile(content, path.extname(filePath));
|
||||
|
@ -75,7 +75,7 @@ _private.registerRoutes = () => {
|
||||
} catch (err) {
|
||||
if (errors.utils.isIgnitionError(err)) {
|
||||
logging.error(err);
|
||||
} else if (err.code !== 'ENOENT') {
|
||||
} else {
|
||||
logging.error(new errors.IncorrectUsageError({
|
||||
message: i18n.t('errors.middleware.redirects.register'),
|
||||
context: err.message,
|
||||
|
Loading…
Reference in New Issue
Block a user