add file existence check to exporters pre file download logic

This commit is contained in:
binsky 2023-06-27 17:42:52 +02:00
parent 46cabce0c5
commit c98d906b7a
No known key found for this signature in database
GPG key ID: B438F7FA2E3AC98F

View file

@ -75,44 +75,49 @@ if (!window['PassmanExporter']) {
}
}).bind(this);
for (var i = 0; i < credentials.length; i++) {
var item = credentials[i];
for (let i = 0; i < credentials.length; i++) {
const credential = credentials[i];
// Custom fields
for (c = 0; c < item.custom_fields.length; c++) {
var cf = item.custom_fields[c];
for (let c = 0; c < credential.custom_fields.length; c++) {
const cf = credential.custom_fields[c];
if (cf.field_type === 'file') {
const file = cf.value;
if (file !== "undefined" && file !== undefined && file !== null && file.file_id !== undefined) {
this.parent.total++;
this.parent.fileGUID_cred[file.guid] = {
cred_pos: i,
on: 'custom_fields',
at: c
};
this.parent.FS.getFile(file).then((function (data) {
this.parent.step(data);
}).bind(this), (function (error) {
this.parent.stepFailed(error);
}).bind(this));
}
}
}
// Also get all files
for (let c = 0; c < credential.files.length; c++) {
const file = credential.files[c];
if (file !== "undefined" && file !== undefined && file !== null && file.file_id !== undefined) {
this.parent.total++;
this.parent.fileGUID_cred[cf.value.guid] = {
this.parent.fileGUID_cred[file.guid] = {
cred_pos: i,
on: 'custom_fields',
on: 'files',
at: c
};
this.parent.FS.getFile(cf.value).then((function (data) {
this.parent.FS.getFile(file).then((function (data) {
this.parent.step(data);
}).bind(this), (function (error) {
this.parent.stepFailed(error);
}).bind(this));
}
}
// Also get all files
for (var c = 0; c < item.files.length; c++) {
this.parent.total++;
this.parent.fileGUID_cred[item.files[c].guid] = {
cred_pos: i,
on: 'files',
at: c
};
this.parent.FS.getFile(item.files[c]).then((function (data) {
this.parent.step(data);
}).bind(this), (function (error) {
this.parent.stepFailed(error);
}).bind(this));
}
}
// We have finished downloading everything, so let's hand over job to somewhere else!