mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-27 00:56:13 +01:00
fix: closes #12858
This commit is contained in:
@@ -17,17 +17,12 @@ module.exports = {
|
|||||||
const { progress } = this;
|
const { progress } = this;
|
||||||
|
|
||||||
const folder = path.join(nconf.get('upload_path'), 'profile');
|
const folder = path.join(nconf.get('upload_path'), 'profile');
|
||||||
|
await mkdirp(folder);
|
||||||
const userPicRegex = /^\d+-profile/;
|
const userPicRegex = /^\d+-profile/;
|
||||||
let files = [];
|
|
||||||
try {
|
const files = (await fs.promises.readdir(folder, { withFileTypes: true }))
|
||||||
files = (await fs.promises.readdir(folder, { withFileTypes: true }))
|
|
||||||
.filter(item => !item.isDirectory() && String(item.name).match(userPicRegex))
|
.filter(item => !item.isDirectory() && String(item.name).match(userPicRegex))
|
||||||
.map(item => item.name);
|
.map(item => item.name);
|
||||||
} catch (err) {
|
|
||||||
console.error(err.stack);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
progress.total = files.length;
|
progress.total = files.length;
|
||||||
await batch.processArray(files, async (files) => {
|
await batch.processArray(files, async (files) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user