* Fix CRC32 meta

* Properly store upload user info in meta @ upload
This commit is contained in:
Bryan Ashby 2017-02-12 00:24:24 -07:00
parent 50a5b8d78e
commit edb9d32acc
2 changed files with 20 additions and 11 deletions

View File

@ -522,7 +522,7 @@ function scanFile(filePath, options, iterator, cb) {
} else if('sha1' === hashName || 'md5' === hashName) {
stepInfo[hashName] = fileEntry.meta[`file_${hashName}`] = hashes[hashName].digest('hex');
} 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);

View File

@ -314,9 +314,13 @@ exports.getModule = class UploadModule extends MenuModule {
self.client.log.debug('Scanning upload(s)', { paths : this.recvFilePaths } );
let currentFileNum = 0;
async.eachSeries(this.recvFilePaths, (filePath, nextFilePath) => {
// :TODO: virus scanning/etc. should occur around here
currentFileNum += 1;
self.scanStatus = {
indicatorPos : 0,
};
@ -327,6 +331,9 @@ exports.getModule = class UploadModule extends MenuModule {
};
function handleScanStep(stepInfo, nextScanStep) {
stepInfo.totalFileNum = self.recvFilePaths.length;
stepInfo.currentFileNum = currentFileNum;
self.updateScanStepInfoViews(stepInfo);
return nextScanStep(null);
}
@ -401,6 +408,9 @@ exports.getModule = class UploadModule extends MenuModule {
prepDetailsForUpload(scanResults, cb) {
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) => {
if(err) {
return nextEntry(err);
@ -474,15 +484,14 @@ exports.getModule = class UploadModule extends MenuModule {
function populateDupeInfo(dupeListView, callback) {
const dupeInfoFormat = self.menuConfig.config.dupeInfoFormat || '{fileName} @ {areaName}';
dupes.forEach(dupe => {
const formatted = stringFormat(dupeInfoFormat, dupe);
if(dupeListView) {
// dupesInfoFormatX
dupeListView.addText(enigmaToAnsi(formatted));
dupeListView.setItems(dupes.map(dupe => stringFormat(dupeInfoFormat, dupe) ) );
dupeListView.redraw();
} else {
self.client.term.pipeWrite(`${formatted}\n`);
}
dupes.forEach(dupe => {
self.client.term.pipeWrite(`${stringFormat(dupeInfoFormat, dupe)}\n`);
});
}
return callback(null);
},