mirror of
https://github.com/nextcloud/passman.git
synced 2025-10-08 20:46:12 +08:00
add file existence check to exporters pre file download logic
This commit is contained in:
parent
46cabce0c5
commit
c98d906b7a
1 changed files with 29 additions and 24 deletions
|
@ -75,44 +75,49 @@ if (!window['PassmanExporter']) {
|
||||||
}
|
}
|
||||||
}).bind(this);
|
}).bind(this);
|
||||||
|
|
||||||
for (var i = 0; i < credentials.length; i++) {
|
for (let i = 0; i < credentials.length; i++) {
|
||||||
|
const credential = credentials[i];
|
||||||
var item = credentials[i];
|
|
||||||
|
|
||||||
// Custom fields
|
// Custom fields
|
||||||
for (c = 0; c < item.custom_fields.length; c++) {
|
for (let c = 0; c < credential.custom_fields.length; c++) {
|
||||||
var cf = item.custom_fields[c];
|
const cf = credential.custom_fields[c];
|
||||||
if (cf.field_type === 'file') {
|
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.total++;
|
||||||
this.parent.fileGUID_cred[cf.value.guid] = {
|
this.parent.fileGUID_cred[file.guid] = {
|
||||||
cred_pos: i,
|
cred_pos: i,
|
||||||
on: 'custom_fields',
|
on: 'files',
|
||||||
at: c
|
at: c
|
||||||
};
|
};
|
||||||
|
|
||||||
this.parent.FS.getFile(cf.value).then((function (data) {
|
this.parent.FS.getFile(file).then((function (data) {
|
||||||
this.parent.step(data);
|
this.parent.step(data);
|
||||||
}).bind(this), (function (error) {
|
}).bind(this), (function (error) {
|
||||||
this.parent.stepFailed(error);
|
this.parent.stepFailed(error);
|
||||||
}).bind(this));
|
}).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!
|
// We have finished downloading everything, so let's hand over job to somewhere else!
|
||||||
|
|
Loading…
Add table
Reference in a new issue