mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-30 02:25:55 +01:00
fix: posts.uploads.usage since paths changed
This commit is contained in:
@@ -143,13 +143,12 @@ module.exports = function (Posts) {
|
||||
filePaths = [filePaths];
|
||||
}
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
// windows path => 'files\\1685368788211-1-profileimg.jpg'
|
||||
// turn it into => 'files/1685368788211-1-profileimg.jpg'
|
||||
filePaths.forEach((file) => {
|
||||
file.path = file.path.split(path.sep).join(path.posix.sep);
|
||||
});
|
||||
}
|
||||
// windows path => 'files\\1685368788211-1-profileimg.jpg'
|
||||
// linux path => files/1685368788211-1-profileimg.jpg
|
||||
// turn them into => '/files/1685368788211-1-profileimg.jpg'
|
||||
filePaths.forEach((file) => {
|
||||
file.path = `/${file.path.split(path.sep).join(path.posix.sep)}`;
|
||||
});
|
||||
|
||||
const keys = filePaths.map(fileObj => `upload:${md5(fileObj.path.replace('-resized', ''))}:pids`);
|
||||
return await Promise.all(keys.map(k => db.getSortedSetRange(k, 0, -1)));
|
||||
|
||||
Reference in New Issue
Block a user