Skip to content

Commit

Permalink
Use req.path instead of req.url to check for file extension
Browse files Browse the repository at this point in the history
fixes #6516
  • Loading branch information
halfdan authored and Fabian Becker committed Feb 17, 2016
1 parent e0239c4 commit f14910f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/server/middleware/static-theme.js
Expand Up @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions core/test/unit/middleware/static-theme_spec.js
Expand Up @@ -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);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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'; }
}
Expand All @@ -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; }
}
Expand Down

0 comments on commit f14910f

Please sign in to comment.