mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-09 10:34:17 +00:00
fix paths & use async rm
This commit is contained in:
parent
386a09f6e2
commit
728e9eea2d
@ -13,9 +13,7 @@ export default {
|
||||
"withAuthentication",
|
||||
],
|
||||
fn: async (req, res) => {
|
||||
const userPath = path.join(this.default.contexts.cache.constructor.cachePath, req.auth.session.user_id)
|
||||
|
||||
const tmpPath = path.resolve(userPath)
|
||||
const tmpPath = path.resolve(this.default.contexts.cache.constructor.cachePath, req.auth.session.user_id)
|
||||
|
||||
const limits = {
|
||||
maxFileSize: parseInt(this.default.contexts.limits.maxFileSizeInMB) * 1024 * 1024,
|
||||
@ -62,13 +60,13 @@ export default {
|
||||
cachePath: tmpPath,
|
||||
})
|
||||
|
||||
fs.promises.rm(tmpPath, { recursive: true, force: true }).catch(() => {
|
||||
await fs.promises.rm(tmpPath, { recursive: true, force: true }).catch(() => {
|
||||
return false
|
||||
})
|
||||
|
||||
return result
|
||||
} catch (error) {
|
||||
fs.promises.rm(tmpPath, { recursive: true, force: true }).catch(() => {
|
||||
await fs.promises.rm(tmpPath, { recursive: true, force: true }).catch(() => {
|
||||
return false
|
||||
})
|
||||
|
||||
@ -77,7 +75,8 @@ export default {
|
||||
}
|
||||
|
||||
return {
|
||||
ok: 1
|
||||
ok: 1,
|
||||
chunkNumber: req.headers["uploader-chunk-number"],
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user