0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-27 22:49:56 -05:00

Merge pull request #6517 from halfdan/fix-6516

Use req.path instead of req.url to check for file extension
This commit is contained in:
Hannah Wolfe 2016-02-18 08:37:32 +00:00
commit 71062a0026
2 changed files with 6 additions and 6 deletions

View file

@ -23,7 +23,7 @@ function forwardToExpressStatic(req, res, next) {
function staticTheme() {
return function blackListStatic(req, res, next) {
if (isBlackListedFileType(req.url)) {
if (isBlackListedFileType(req.path)) {
return next();
}
return forwardToExpressStatic(req, res, next);

View file

@ -14,7 +14,7 @@ describe('staticTheme', function () {
it('should call next if hbs file type', function () {
var req = {
url: 'mytemplate.hbs'
path: 'mytemplate.hbs'
};
staticTheme(null)(req, null, next);
@ -23,7 +23,7 @@ describe('staticTheme', function () {
it('should call next if md file type', function () {
var req = {
url: 'README.md'
path: 'README.md'
};
staticTheme(null)(req, null, next);
@ -32,7 +32,7 @@ describe('staticTheme', function () {
it('should call next if json file type', function () {
var req = {
url: 'sample.json'
path: 'sample.json'
};
staticTheme(null)(req, null, next);
@ -41,7 +41,7 @@ describe('staticTheme', function () {
it('should call express.static if valid file type', function (done) {
var req = {
url: 'myvalidfile.css',
path: 'myvalidfile.css',
app: {
get: function () { return 'casper'; }
}
@ -65,7 +65,7 @@ describe('staticTheme', function () {
it('should not error if active theme is missing', function (done) {
var req = {
url: 'myvalidfile.css',
path: 'myvalidfile.css',
app: {
get: function () { return undefined; }
}