mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
messages: fix EPERM error by verifying temp file removal when sending images (#1227)
* messages: add verification to remove temp file, solve EPERM operation not permitted * fix lint on messages * another try to fix lint for pr health * Fixed, too many changes were breaking the code; this should be enough * another try to fix this
This commit is contained in:
@@ -225,8 +225,13 @@ export const prepareWAMessageMedia = async(
|
||||
encWriteStream.destroy()
|
||||
// remove tmp files
|
||||
if(didSaveToTmpPath && bodyPath) {
|
||||
await fs.unlink(bodyPath)
|
||||
logger?.debug('removed tmp files')
|
||||
try {
|
||||
await fs.access(bodyPath)
|
||||
await fs.unlink(bodyPath)
|
||||
logger?.debug('removed tmp file')
|
||||
} catch(error) {
|
||||
logger?.warn('failed to remove tmp file')
|
||||
}
|
||||
}
|
||||
}
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user