This commit is contained in:
Julian Lam
2018-04-16 12:46:20 -04:00
parent 551daa141b
commit 5943389b7a
2 changed files with 118 additions and 1 deletions

View File

@@ -46,8 +46,8 @@ module.exports = function (Posts) {
Posts.uploads.associate = function (pid, filePaths, callback) {
// Adds an upload to a post's sorted set of uploads
const now = Date.now();
const scores = filePaths.map(() => now);
filePaths = !Array.isArray(filePaths) ? [filePaths] : filePaths;
const scores = filePaths.map(() => now);
db.sortedSetAdd('post:' + pid + ':uploads', scores, filePaths, callback);
};