@@ -34,30 +34,30 @@ export class ClamAvFileScanningConnector extends BaseQueueFileScanningConnector
34
34
this . av = await new NodeClam ( ) . init ( { clamdscan : config . avScanning . clamdscan } )
35
35
const scannerVersion = await this . av . getVersion ( )
36
36
this . version = safeParseVersion ( scannerVersion )
37
- log . debug ( { version : this . version } , 'Initialised Clam AV scanner' )
37
+ log . debug ( { ... this . info ( ) } , 'Initialised Clam AV scanner' )
38
38
return this
39
39
}
40
40
41
41
async _scan ( file : FileInterfaceDoc ) : Promise < FileScanResult [ ] > {
42
+ const scannerInfo = this . info ( )
42
43
if ( ! this . av ) {
43
- return await this . scanError ( `Could not use ${ this . toolName } as it is not been correctly initialised.` )
44
+ return await this . scanError ( `Could not use ${ this . toolName } as it is not been correctly initialised.` , {
45
+ ...scannerInfo ,
46
+ } )
44
47
}
45
48
46
49
const getObjectStreamResponse = await getObjectStream ( file . path )
47
50
const s3Stream = getObjectStreamResponse . Body as Readable | null
48
51
if ( ! s3Stream ) {
49
- return await this . scanError ( `Stream for file ${ file . path } is not available` )
52
+ return await this . scanError ( `Stream for file ${ file . path } is not available` , { file , ... scannerInfo } )
50
53
}
51
54
52
55
try {
53
56
const { isInfected, viruses } = await this . av . scanStream ( s3Stream )
54
- log . info (
55
- { modelId : file . modelId , fileId : file . _id . toString ( ) , name : file . name , result : { isInfected, viruses } } ,
56
- 'Scan complete.' ,
57
- )
57
+ log . debug ( { file, result : { isInfected, viruses } , ...scannerInfo } , 'Scan complete.' )
58
58
return [
59
59
{
60
- ...this . info ( ) ,
60
+ ...scannerInfo ,
61
61
state : ScanState . Complete ,
62
62
isInfected,
63
63
viruses,
@@ -68,6 +68,7 @@ export class ClamAvFileScanningConnector extends BaseQueueFileScanningConnector
68
68
return this . scanError ( `This file could not be scanned due to an error caused by ${ this . toolName } ` , {
69
69
error,
70
70
file,
71
+ ...scannerInfo ,
71
72
} )
72
73
} finally {
73
74
if ( s3Stream ) {
0 commit comments