v1.18.x
barisusakli 9 years ago
parent 2c65b2ecf3
commit b44f3f4811

@ -40,18 +40,21 @@ module.exports = function (Meta) {
if (err) { if (err) {
return next(); return next();
} }
try {
var configObj = JSON.parse(file.toString()); var configObj = JSON.parse(file.toString());
// Minor adjustments for API output // Minor adjustments for API output
configObj.type = 'local'; configObj.type = 'local';
if (configObj.screenshot) { if (configObj.screenshot) {
configObj.screenshot_url = nconf.get('relative_path') + '/css/previews/' + configObj.id; configObj.screenshot_url = nconf.get('relative_path') + '/css/previews/' + configObj.id;
} else { } else {
configObj.screenshot_url = nconf.get('relative_path') + '/images/themes/default.png'; configObj.screenshot_url = nconf.get('relative_path') + '/images/themes/default.png';
}
next(null, configObj);
} catch (err) {
winston.error('[themes] Unable to parse theme.json ' + theme);
next(null, null);
} }
next(null, configObj);
}); });
}, function (err, themes) { }, function (err, themes) {
@ -59,9 +62,7 @@ module.exports = function (Meta) {
return callback(err); return callback(err);
} }
themes = themes.filter(function (theme) { themes = themes.filter(Boolean);
return (theme !== undefined);
});
callback(null, themes); callback(null, themes);
}); });
}); });

Loading…
Cancel
Save