0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Merge pull request #6374 from jtwebman/admin_error_no_theme

Fixed ghost admin error when missing theme folder.
This commit is contained in:
Hannah Wolfe 2016-01-25 12:29:31 +00:00
commit 4e355ecba9
2 changed files with 28 additions and 4 deletions

View file

@ -11,11 +11,15 @@ function isBlackListedFileType(file) {
}
function forwardToExpressStatic(req, res, next) {
if (!req.app.get('activeTheme')) {
next();
} else {
express.static(
path.join(config.paths.themePath, req.app.get('activeTheme')),
{maxAge: utils.ONE_YEAR_MS}
)(req, res, next);
}
}
function staticTheme() {
return function blackListStatic(req, res, next) {

View file

@ -65,4 +65,24 @@ describe('staticTheme', function () {
done();
});
});
it('should not error if active theme is missing', function (done) {
var req = {
url: 'myvalidfile.css',
app: {
get: function () { return undefined; }
}
},
activeThemeStub,
sandbox = sinon.sandbox.create();
activeThemeStub = sandbox.spy(req.app, 'get');
staticTheme(null)(req, null, function (reqArg, res, next2) {
/*jshint unused:false */
sandbox.restore();
next.called.should.be.false;
done();
});
});
});