mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
✨ Added well-known assetlinks.json to allowed files
refs: https://github.com/google/digitalassetlinks/blob/master/well-known/specification.md refs: https://github.com/google/digitalassetlinks/blob/master/well-known/details.md - allow themes to include assetlinks.json files to comply with the Google digital asset links spec
This commit is contained in:
parent
b8069c60e9
commit
0049b74a2d
@ -45,7 +45,7 @@ function isAllowedFile(file) {
|
||||
|
||||
const normalizedFilePath = path.normalize(decodedFilePath);
|
||||
|
||||
const allowedFiles = ['manifest.json'];
|
||||
const allowedFiles = ['manifest.json', 'assetlinks.json'];
|
||||
const allowedPath = '/assets/';
|
||||
const alwaysDeny = ['.hbs'];
|
||||
|
||||
|
@ -157,6 +157,23 @@ describe('staticTheme', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('should NOT skip if file is allowed even if nested', function (done) {
|
||||
req.path = '/.well-known/assetlinks.json';
|
||||
|
||||
staticTheme()(req, res, function next() {
|
||||
// Specifically gets called twice
|
||||
activeThemeStub.calledTwice.should.be.true();
|
||||
expressStaticStub.called.should.be.true();
|
||||
|
||||
// Check that express static gets called with the theme path + maxAge
|
||||
should.exist(expressStaticStub.firstCall.args);
|
||||
expressStaticStub.firstCall.args[0].should.eql('my/fake/path');
|
||||
expressStaticStub.firstCall.args[1].should.be.an.Object().with.property('maxAge');
|
||||
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('should NOT skip if file is in assets', function (done) {
|
||||
req.path = '/assets/whatever.json';
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user