Fix incorrect use of fs.stat
This commit is contained in:
parent
6e1a73eea2
commit
221b7145f1
@ -49,7 +49,7 @@ class Uploader {
|
|||||||
do {
|
do {
|
||||||
randomName = crypto.randomBytes(8).toString("hex");
|
randomName = crypto.randomBytes(8).toString("hex");
|
||||||
destPath = path.join(Helper.getFileUploadPath(), randomName.substring(0, 2), randomName);
|
destPath = path.join(Helper.getFileUploadPath(), randomName.substring(0, 2), randomName);
|
||||||
} while (fs.stat(destPath, (err) => (err ? true : false)));
|
} while (fs.existsSync(destPath));
|
||||||
|
|
||||||
fsextra.move(data.file.pathName, destPath).then(() => {
|
fsextra.move(data.file.pathName, destPath).then(() => {
|
||||||
const slug = encodeURIComponent(path.basename(data.file.pathName));
|
const slug = encodeURIComponent(path.basename(data.file.pathName));
|
||||||
|
Loading…
Reference in New Issue
Block a user