Skip to content

Commit

Permalink
Merge pull request #115 from OpenDroneMap/images
Browse files Browse the repository at this point in the history
Fix exists call, count images after upload
  • Loading branch information
pierotofy committed Jun 22, 2024
2 parents 0562a47 + 1c1ce4f commit 32f3d27
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions libs/taskNew.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,13 @@ module.exports = {
saveStream.close();
saveStream = null;
}
if (fs.exists(saveTo, exists => {
params.imagesCount--;
fs.unlink(saveTo, err => {
if (err) logger.error(err);
});
}));
fs.exists(saveTo, exists => {
if (exists){
fs.unlink(saveTo, err => {
if (err) logger.error(err);
});
}
});
};
req.on('close', handleClose);
req.on('abort', handleClose);
Expand All @@ -186,11 +187,14 @@ module.exports = {
req.removeListener('close', handleClose);
req.removeListener('abort', handleClose);
saveStream = null;
params.imagesCount++;
if (options.limits.maxImages && params.imagesCount > options.limits.maxImages){
params.error = "Max images count exceeded.";
}
});

saveStream = fs.createWriteStream(saveTo)
file.pipe(saveStream);
params.imagesCount++;
}
});
}
Expand Down

0 comments on commit 32f3d27

Please sign in to comment.