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() {
|
||||
return function blackListStatic(req, res, next) {
|
||||
if (isBlackListedFileType(req.url)) {
|
||||
if (isBlackListedFileType(req.path)) {
|
||||
return next();
|
||||
}
|
||||
return forwardToExpressStatic(req, res, next);
|
||||
|
|
|
@ -17,7 +17,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);
|
||||
|
@ -26,7 +26,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);
|
||||
|
@ -35,7 +35,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);
|
||||
|
@ -44,7 +44,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'; }
|
||||
}
|
||||
|
@ -68,7 +68,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; }
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue