fix cross-device rename

fix for `Error: EXDEV: cross-device link not permitted`
This commit is contained in:
Shiwei Wang 2021-02-09 16:22:08 +08:00 committed by GitHub
parent 2879724737
commit 839772a089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,7 @@ router.post("/upload", upload.single("upload_file"), (req, res) => {
if (req.file) {
const originalname = req.file.originalname;
const dstPath = pathm.join(target_path, originalname);
fs.rename(req.file.path, dstPath, (err) => {
fs.move(req.file.path, dstPath, (err) => {
if (err) {
res.status(500).send("上传虽然成功,但是处理文件出错: " + err);
} else {