Skip to content

Commit

Permalink
Merge pull request #74 from WildMeOrg/issue_68_73
Browse files Browse the repository at this point in the history
fix error/death during gm.identify() on bad file
  • Loading branch information
TanyaStere42 authored Feb 22, 2024
2 parents f5228c4 + 78d6421 commit d990386
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ init();


}
if(ext == 'jpg'){
if ((ext == 'jpg') || (ext == 'jpeg')) {
// move to tmp directory, adding small .jpg extension, get full path of new file
tempPath = settingsObject.tmpDirectory+'unprocessedImages/'+filename+'.jpg';
await fs.promises.copyFile(ingestionDir+'/'+randomElement,tempPath);
Expand Down Expand Up @@ -1346,6 +1346,7 @@ const convertToJpg = async (path,filename) => {
return new Promise((resolve, reject) => {
gm(path).write(newPath, (err) => {
if(err){
console.log(`Conversion error: ${err}`);
reject(err);
} else {
resolve(newPath)
Expand Down Expand Up @@ -1392,7 +1393,8 @@ const parseExif = async (path) => {
return new Promise((resolve, reject) => {
gm(path).identify( async (err,data) => {
if(err){
reject(err);
console.log(`Identify error: ${err}`);
return resolve({});
} else {

possibleTimestamps = [];
Expand Down

0 comments on commit d990386

Please sign in to comment.