Skip to content

Commit

Permalink
[mattermost-communityGH-7] Check Ping for ClamAV server
Browse files Browse the repository at this point in the history
  • Loading branch information
anidok committed Dec 15, 2019
1 parent 9a45cd7 commit fc78c4f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions server/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ func (p *Plugin) FileWillBeUploaded(c *plugin.Context, info *model.FileInfo, fil
config := p.getConfiguration()

av := clamd.NewClamd("tcp://" + config.ClamavHostPort)
err := av.Ping()
if err != nil {
p.API.LogError("File Scanning Server unreachable, contact your Mattermost administrator for assistance. " + err.Error())
return nil, "File Scanning Server unreachable, contact your Mattermost administrator for assistance."
}

abortScan := make(chan bool)
response, err := av.ScanStream(file, abortScan)
if err != nil {
Expand Down

0 comments on commit fc78c4f

Please sign in to comment.