From c41c7e8a036bcecc2c64feeeef25aaa81e92762b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Fri, 4 Apr 2025 11:04:09 -0400 Subject: [PATCH] fix: posts.uploads.usage since paths changed --- src/posts/uploads.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/posts/uploads.js b/src/posts/uploads.js index 9484853db5..c468c76727 100644 --- a/src/posts/uploads.js +++ b/src/posts/uploads.js @@ -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)));