Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async.eachSeries(files, function(file, cb) {
// var file = files[i];
var needFile = {
FileId: file.ServerFileId,
LocalFileId: file.FileId,
Type: file.Type,
HasBody: false,
IsAttach: file.IsAttach,
};
// console.log(file);
// 要传数据的
if(file.IsDirty) {
// TODO
if(file.Path.indexOf('data/') == 0) {
file.Path = Evt.getAbsolutePath(file.Path);
}
fs.exists(file.Path, function(isExists) {
if(isExists) {
needTransferFiles[file.FileId] = {
file: file.Path,
content_type: 'application/' + file.Type // TODO
}
if(file.Title) {
needTransferFiles[file.FileId].filename = file.Title;
}
needFile.HasBody = true;
needPostFilesAttr.push(needFile);
}
return cb();
});
} else {
async.eachSeries(files, function(file, cb) {
// var file = files[i];
var needFile = {
FileId: file.ServerFileId,
LocalFileId: file.FileId,
Type: file.Type,
HasBody: false,
IsAttach: file.IsAttach,
};
// console.log(file);
// 要传数据的
if(file.IsDirty) {
// TODO
if(file.Path.indexOf('data/') == 0) {
file.Path = Evt.getAbsolutePath(file.Path);
}
fs.exists(file.Path, function(isExists) {
if(isExists) {
needTransferFiles[file.FileId] = {
file: file.Path,
content_type: 'application/' + file.Type // TODO
}
if(file.Title) {
needTransferFiles[file.FileId].filename = file.Title;
}
needFile.HasBody = true;
needPostFilesAttr.push(needFile);
}
return cb();
});
} else {