mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-17 22:10:23 +01:00
fix: thumb remove on windows, closes #11357
This commit is contained in:
@@ -52,6 +52,7 @@ Thumbs.get = async function (tids) {
|
|||||||
const name = path.basename(thumb);
|
const name = path.basename(thumb);
|
||||||
return hasTimestampPrefix.test(name) ? name.slice(14) : name;
|
return hasTimestampPrefix.test(name) ? name.slice(14) : name;
|
||||||
})(),
|
})(),
|
||||||
|
path: thumb,
|
||||||
url: thumb.startsWith('http') ? thumb : path.posix.join(upload_url, thumb),
|
url: thumb.startsWith('http') ? thumb : path.posix.join(upload_url, thumb),
|
||||||
})));
|
})));
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="alert alert-info">[[modules:thumbs.modal.no-thumbs]]</div>
|
<div class="alert alert-info">[[modules:thumbs.modal.no-thumbs]]</div>
|
||||||
{{{ end }}}
|
{{{ end }}}
|
||||||
{{{ each thumbs }}}
|
{{{ each thumbs }}}
|
||||||
<div class="media" data-id="{./id}" data-path="{./url}">
|
<div class="media" data-id="{./id}" data-path="{./path}">
|
||||||
<div class="media-left">
|
<div class="media-left">
|
||||||
<img class="media-object" src="{./url}" alt="" />
|
<img class="media-object" src="{./url}" alt="" />
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ describe('Topic thumbs', () => {
|
|||||||
assert.deepStrictEqual(thumbs, [{
|
assert.deepStrictEqual(thumbs, [{
|
||||||
id: topicObj.topicData.tid,
|
id: topicObj.topicData.tid,
|
||||||
name: 'test.png',
|
name: 'test.png',
|
||||||
|
path: `${relativeThumbPaths[0]}`,
|
||||||
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
|
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
|
||||||
}]);
|
}]);
|
||||||
});
|
});
|
||||||
@@ -92,6 +93,7 @@ describe('Topic thumbs', () => {
|
|||||||
[{
|
[{
|
||||||
id: topicObj.topicData.tid,
|
id: topicObj.topicData.tid,
|
||||||
name: 'test.png',
|
name: 'test.png',
|
||||||
|
path: `${relativeThumbPaths[0]}`,
|
||||||
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
|
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
|
||||||
}],
|
}],
|
||||||
[],
|
[],
|
||||||
@@ -200,16 +202,19 @@ describe('Topic thumbs', () => {
|
|||||||
{
|
{
|
||||||
id: tid,
|
id: tid,
|
||||||
name: 'test.png',
|
name: 'test.png',
|
||||||
|
path: relativeThumbPaths[0],
|
||||||
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
|
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[0]}`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: tid,
|
id: tid,
|
||||||
name: 'example.org',
|
name: 'example.org',
|
||||||
|
path: 'https://example.org',
|
||||||
url: 'https://example.org',
|
url: 'https://example.org',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: tid,
|
id: tid,
|
||||||
name: 'test2.png',
|
name: 'test2.png',
|
||||||
|
path: relativeThumbPaths[1],
|
||||||
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[1]}`,
|
url: `${nconf.get('relative_path')}${nconf.get('upload_url')}${relativeThumbPaths[1]}`,
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
Reference in New Issue
Block a user