Skip to content

Commit

Permalink
HTTP Server: Fix CSV deletion (#530)
Browse files Browse the repository at this point in the history
  • Loading branch information
AgnesToulet authored Jun 11, 2024
1 parent d3165a1 commit 4f04533
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/service/http-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,12 +296,17 @@ export class HttpServer {
} else {
try {
this.log.debug('Deleting temporary file', 'file', result.filePath);
fs.unlinkSync(result.filePath);
if (!options.filePath) {
fs.rmdirSync(path.dirname(result.filePath));
}
fs.unlink(result.filePath, (err) => {
if (err) {
throw err
}

if (!options.filePath) {
fs.rmdir(path.dirname(result.filePath), () => {});
}
})
} catch (e) {
this.log.error('Failed to delete temporary file', 'file', result.filePath);
this.log.error('Failed to delete temporary file', 'file', result.filePath, 'error', e.message);
}
}
});
Expand Down

0 comments on commit 4f04533

Please sign in to comment.