From 767c1d1faf0dfd8204c0701cc6823678b1774678 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 14 Mar 2023 15:09:12 -0400 Subject: [PATCH] fix: thumb remove on windows, closes #11357 --- src/topics/thumbs.js | 1 + src/views/modals/topic-thumbs.tpl | 2 +- test/topics/thumbs.js | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/topics/thumbs.js b/src/topics/thumbs.js index f6f6a88400..60db184339 100644 --- a/src/topics/thumbs.js +++ b/src/topics/thumbs.js @@ -52,6 +52,7 @@ Thumbs.get = async function (tids) { const name = path.basename(thumb); return hasTimestampPrefix.test(name) ? name.slice(14) : name; })(), + path: thumb, url: thumb.startsWith('http') ? thumb : path.posix.join(upload_url, thumb), }))); diff --git a/src/views/modals/topic-thumbs.tpl b/src/views/modals/topic-thumbs.tpl index e7ecd24e13..1329cf7c95 100644 --- a/src/views/modals/topic-thumbs.tpl +++ b/src/views/modals/topic-thumbs.tpl @@ -3,7 +3,7 @@
[[modules:thumbs.modal.no-thumbs]]
{{{ end }}} {{{ each thumbs }}} -
+
diff --git a/test/topics/thumbs.js b/test/topics/thumbs.js index 8486947b76..272d5cac32 100644 --- a/test/topics/thumbs.js +++ b/test/topics/thumbs.js @@ -82,6 +82,7 @@ describe('Topic thumbs', () => { assert.deepStrictEqual(thumbs, [{ id: topicObj.topicData.tid, name: 'test.png', + path: `${relativeThumbPaths[0]}`, url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`, }]); }); @@ -92,6 +93,7 @@ describe('Topic thumbs', () => { [{ id: topicObj.topicData.tid, name: 'test.png', + path: `${relativeThumbPaths[0]}`, url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`, }], [], @@ -200,16 +202,19 @@ describe('Topic thumbs', () => { { id: tid, name: 'test.png', + path: relativeThumbPaths[0], url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`, }, { id: tid, name: 'example.org', + path: 'https://example.org', url: 'https://example.org', }, { id: tid, name: 'test2.png', + path: relativeThumbPaths[1], url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[1]}`, }, ]);