Merge pull request #644 from WebTools-NG/ukdtom/issue643

[BUG] Output all 'Export' fields failed to proceed
This commit is contained in:
Tommy Mikkelsen 2022-12-02 22:35:25 +01:00 committed by GitHub
commit 1879508b31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1783,10 +1783,23 @@ const etHelper = new class ETHELPER {
let files = await this.getExportPicsUrlandFile( { type: extype, data: data} );
let title = String(JSONPath({path: '$.title', json: data})[0]);
for (var idx in files){
if ( files[idx]['url'].endsWith('undefined')){
log.error(`[ethelper.js] (exportPics) - could not find picture for ${files[idx]['outFile']}`)
let errorFile = files[idx]['outFile'];
errorFile = errorFile.replace('.jpg', '.txt');
const fs = require('fs');
try {
fs.writeFileSync( errorFile, `etHelper (forceDownload-downloadError) downloading pic for "${title}" was not found`, 'utf-8');
}
catch(e) {
log.error(`etHelper (forceDownload-downloadError) failed to save error file: ${errorFile}`);
}
} else {
log.silly(`[ethelper.js] (exportPics) - downloading ${files[idx]['url']} as file ${files[idx]['outFile']} with a title as ${title}`)
await this.forceDownload( { url:files[idx]['url'], target:files[idx]['outFile'], title:title} );
}
}
}
async getXLSXHeader(){
if ( this.Settings.xlsxHeader ){