* Fix CRC32 meta
* Properly store upload user info in meta @ upload
This commit is contained in:
parent
50a5b8d78e
commit
edb9d32acc
|
@ -522,7 +522,7 @@ function scanFile(filePath, options, iterator, cb) {
|
||||||
} else if('sha1' === hashName || 'md5' === hashName) {
|
} else if('sha1' === hashName || 'md5' === hashName) {
|
||||||
stepInfo[hashName] = fileEntry.meta[`file_${hashName}`] = hashes[hashName].digest('hex');
|
stepInfo[hashName] = fileEntry.meta[`file_${hashName}`] = hashes[hashName].digest('hex');
|
||||||
} else if('crc32' === hashName) {
|
} else if('crc32' === hashName) {
|
||||||
stepInfo.crc32 = fileEntry.meta.crc32 = hashes.crc32.finalize().toString(16);
|
stepInfo.crc32 = fileEntry.meta.file_crc32 = hashes.crc32.finalize().toString(16);
|
||||||
}
|
}
|
||||||
|
|
||||||
return nextHash(null);
|
return nextHash(null);
|
||||||
|
|
|
@ -314,9 +314,13 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||||
|
|
||||||
self.client.log.debug('Scanning upload(s)', { paths : this.recvFilePaths } );
|
self.client.log.debug('Scanning upload(s)', { paths : this.recvFilePaths } );
|
||||||
|
|
||||||
|
let currentFileNum = 0;
|
||||||
|
|
||||||
async.eachSeries(this.recvFilePaths, (filePath, nextFilePath) => {
|
async.eachSeries(this.recvFilePaths, (filePath, nextFilePath) => {
|
||||||
// :TODO: virus scanning/etc. should occur around here
|
// :TODO: virus scanning/etc. should occur around here
|
||||||
|
|
||||||
|
currentFileNum += 1;
|
||||||
|
|
||||||
self.scanStatus = {
|
self.scanStatus = {
|
||||||
indicatorPos : 0,
|
indicatorPos : 0,
|
||||||
};
|
};
|
||||||
|
@ -327,6 +331,9 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||||
};
|
};
|
||||||
|
|
||||||
function handleScanStep(stepInfo, nextScanStep) {
|
function handleScanStep(stepInfo, nextScanStep) {
|
||||||
|
stepInfo.totalFileNum = self.recvFilePaths.length;
|
||||||
|
stepInfo.currentFileNum = currentFileNum;
|
||||||
|
|
||||||
self.updateScanStepInfoViews(stepInfo);
|
self.updateScanStepInfoViews(stepInfo);
|
||||||
return nextScanStep(null);
|
return nextScanStep(null);
|
||||||
}
|
}
|
||||||
|
@ -401,6 +408,9 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||||
|
|
||||||
prepDetailsForUpload(scanResults, cb) {
|
prepDetailsForUpload(scanResults, cb) {
|
||||||
async.eachSeries(scanResults.newEntries, (newEntry, nextEntry) => {
|
async.eachSeries(scanResults.newEntries, (newEntry, nextEntry) => {
|
||||||
|
newEntry.meta.upload_by_username = this.client.user.username;
|
||||||
|
newEntry.meta.upload_by_user_id = this.client.user.userId;
|
||||||
|
|
||||||
this.displayFileDetailsPageForUploadEntry(newEntry, (err, newValues) => {
|
this.displayFileDetailsPageForUploadEntry(newEntry, (err, newValues) => {
|
||||||
if(err) {
|
if(err) {
|
||||||
return nextEntry(err);
|
return nextEntry(err);
|
||||||
|
@ -474,15 +484,14 @@ exports.getModule = class UploadModule extends MenuModule {
|
||||||
function populateDupeInfo(dupeListView, callback) {
|
function populateDupeInfo(dupeListView, callback) {
|
||||||
const dupeInfoFormat = self.menuConfig.config.dupeInfoFormat || '{fileName} @ {areaName}';
|
const dupeInfoFormat = self.menuConfig.config.dupeInfoFormat || '{fileName} @ {areaName}';
|
||||||
|
|
||||||
dupes.forEach(dupe => {
|
if(dupeListView) {
|
||||||
const formatted = stringFormat(dupeInfoFormat, dupe);
|
dupeListView.setItems(dupes.map(dupe => stringFormat(dupeInfoFormat, dupe) ) );
|
||||||
if(dupeListView) {
|
dupeListView.redraw();
|
||||||
// dupesInfoFormatX
|
} else {
|
||||||
dupeListView.addText(enigmaToAnsi(formatted));
|
dupes.forEach(dupe => {
|
||||||
} else {
|
self.client.term.pipeWrite(`${stringFormat(dupeInfoFormat, dupe)}\n`);
|
||||||
self.client.term.pipeWrite(`${formatted}\n`);
|
});
|
||||||
}
|
}
|
||||||
});
|
|
||||||
|
|
||||||
return callback(null);
|
return callback(null);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue