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