Merge remote-tracking branch 'origin/master' into develop

This commit is contained in:
Julian Lam
2017-02-17 09:10:25 -05:00
35 changed files with 403 additions and 258 deletions

View File

@@ -69,7 +69,7 @@ categoryController.get = function (req, res, callback) {
}
if (!settings.usePagination) {
topicIndex = Math.max(topicIndex - (settings.topicsPerPage - 1), 0);
topicIndex = Math.max(0, topicIndex - (Math.ceil(settings.topicsPerPage / 2) - 1));
} else if (!req.query.page) {
var index = Math.max(parseInt((topicIndex || 0), 10), 0);
currentPage = Math.ceil((index + 1) / settings.topicsPerPage);

View File

@@ -365,7 +365,7 @@ Controllers.handle404 = function (req, res) {
if (isClientScript.test(req.url)) {
res.type('text/javascript').status(200).send('');
} else if (req.path.startsWith(relativePath + '/uploads') || (req.get('accept') && req.get('accept').indexOf('text/html') === -1) || req.path === '/favicon.ico') {
} else if (req.path.startsWith(relativePath + '/assets/uploads') || (req.get('accept') && req.get('accept').indexOf('text/html') === -1) || req.path === '/favicon.ico') {
meta.errors.log404(req.path || '');
res.sendStatus(404);
} else if (req.accepts('html')) {

View File

@@ -32,15 +32,15 @@ exports.read = function read(callback) {
fs.readFile(filePath, function (err, buffer) {
if (err) {
winston.warn('[cache-buster] could not read cache buster: ' + err.message);
return callback();
return callback(null, generate());
}
buffer = buffer.toString();
if (buffer) {
cached = buffer;
return callback(null, cached);
if (!buffer || buffer.toString().length !== 11) {
winston.warn('[cache-buster] cache buster string invalid: expected /[a-z0-9]{11}/, got `' + buffer + '`');
return callback(null, generate());
}
callback();
cached = buffer.toString();
callback(null, cached);
});
};

View File

@@ -143,7 +143,12 @@ module.exports = function (Meta) {
return callback(err);
}
postcss(global.env === 'development' ? [ autoprefixer ] : [ autoprefixer, clean() ]).process(lessOutput.css).then(function (result) {
postcss(global.env === 'development' ? [ autoprefixer ] : [
autoprefixer,
clean({
processImportFrom: ['local']
}),
]).process(lessOutput.css).then(function (result) {
result.warnings().forEach(function (warn) {
winston.verbose(warn.toString());
});