mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-23 15:13:09 +02:00
Refactor
This commit is contained in:
parent
d8f8730a74
commit
5052895518
1 changed files with 2 additions and 2 deletions
|
@ -266,11 +266,11 @@ export default (user: any, file: string | stream.Readable, ...args) => new Promi
|
|||
}
|
||||
rej(new Error('un-compatible file.'));
|
||||
})
|
||||
.then(([path, remove]): Promise<any> => new Promise((res, rej) => {
|
||||
.then(([path, shouldCleanup]): Promise<any> => new Promise((res, rej) => {
|
||||
addFile(user, path, ...args)
|
||||
.then(file => {
|
||||
res(file);
|
||||
if (remove) {
|
||||
if (shouldCleanup) {
|
||||
fs.unlink(path, (e) => {
|
||||
if (e) log(e.stack);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue