mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Use req.path instead of req.url to check for file extension
fixes #6516
This commit is contained in:
parent
e0239c44aa
commit
f14910fa8e
2 changed files with 6 additions and 6 deletions
|
@ -23,7 +23,7 @@ function forwardToExpressStatic(req, res, next) {
|
||||||
|
|
||||||
function staticTheme() {
|
function staticTheme() {
|
||||||
return function blackListStatic(req, res, next) {
|
return function blackListStatic(req, res, next) {
|
||||||
if (isBlackListedFileType(req.url)) {
|
if (isBlackListedFileType(req.path)) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
return forwardToExpressStatic(req, res, next);
|
return forwardToExpressStatic(req, res, next);
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('staticTheme', function () {
|
||||||
|
|
||||||
it('should call next if hbs file type', function () {
|
it('should call next if hbs file type', function () {
|
||||||
var req = {
|
var req = {
|
||||||
url: 'mytemplate.hbs'
|
path: 'mytemplate.hbs'
|
||||||
};
|
};
|
||||||
|
|
||||||
staticTheme(null)(req, null, next);
|
staticTheme(null)(req, null, next);
|
||||||
|
@ -26,7 +26,7 @@ describe('staticTheme', function () {
|
||||||
|
|
||||||
it('should call next if md file type', function () {
|
it('should call next if md file type', function () {
|
||||||
var req = {
|
var req = {
|
||||||
url: 'README.md'
|
path: 'README.md'
|
||||||
};
|
};
|
||||||
|
|
||||||
staticTheme(null)(req, null, next);
|
staticTheme(null)(req, null, next);
|
||||||
|
@ -35,7 +35,7 @@ describe('staticTheme', function () {
|
||||||
|
|
||||||
it('should call next if json file type', function () {
|
it('should call next if json file type', function () {
|
||||||
var req = {
|
var req = {
|
||||||
url: 'sample.json'
|
path: 'sample.json'
|
||||||
};
|
};
|
||||||
|
|
||||||
staticTheme(null)(req, null, next);
|
staticTheme(null)(req, null, next);
|
||||||
|
@ -44,7 +44,7 @@ describe('staticTheme', function () {
|
||||||
|
|
||||||
it('should call express.static if valid file type', function (done) {
|
it('should call express.static if valid file type', function (done) {
|
||||||
var req = {
|
var req = {
|
||||||
url: 'myvalidfile.css',
|
path: 'myvalidfile.css',
|
||||||
app: {
|
app: {
|
||||||
get: function () { return 'casper'; }
|
get: function () { return 'casper'; }
|
||||||
}
|
}
|
||||||
|
@ -68,7 +68,7 @@ describe('staticTheme', function () {
|
||||||
|
|
||||||
it('should not error if active theme is missing', function (done) {
|
it('should not error if active theme is missing', function (done) {
|
||||||
var req = {
|
var req = {
|
||||||
url: 'myvalidfile.css',
|
path: 'myvalidfile.css',
|
||||||
app: {
|
app: {
|
||||||
get: function () { return undefined; }
|
get: function () { return undefined; }
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue