End static directories with / in Pass condition

Otherwise, any URL beginning with static path names go to S3.
This commit is contained in:
Ray Schamp 2016-04-25 14:32:52 -04:00
parent 19a0ed3f4b
commit 39063ae76c

View file

@ -31,10 +31,10 @@ var extraAppRoutes = [
*/
var getStaticPaths = function (pathToStatic) {
var staticPaths = glob.sync(path.resolve(__dirname, pathToStatic));
return staticPaths.map( function (pathName) {
return staticPaths.map(function (pathName) {
// Reduce absolute path to relative paths like '/js'
var base = path.dirname(path.resolve(__dirname, pathToStatic));
return '^' + pathName.replace(base, '');
return '^' + pathName.replace(base, '') + (path.extname(pathName) ? '' : '/');
});
};