unspecific message "An unknown error has occurred" on virus upload detection
Note that the antivirus files app is working as expected, besides the unspecific message. The message which I'd like to see is logged correctly in the nextcloud log file, like this:
Error: Virus Win.Test.EICAR_HDB-1 is detected in the file. Upload cannot be completed.
but it does not reach the user in the browser frontend. It is even translated correctly e.g. to german if the users language is german!
Steps to reproduce
- configure nextcloud with the current antivirus app via
- try upload an eicar virus testfile via drag and drop in the browser
- see that uploading is inhibited with the message "An unknown error has occured"
Expected behaviour
I'm expecting to get a message like "unable to upload file xxx because it contains a virus", of course even better also including the viruses name
Actual behaviour
There is only a unspecific "An unknown error has occured" message, leaving the user alone without knowing what went wrong.
Server configuration
Operating system: centos 7 running docker with docker-compose
Web server: apache 2.4.51
Database: mariadb 10.6 official docker image from docker hub
PHP version: 8.0.12 official nextcloud fpm docker image from docker hub
Nextcloud version: (see Nextcloud admin page) 22.2.3 official nextcloud fpm docker image from docker hub
Where did you install Nextcloud from: official nextcloud fpm docker image from docker hub image nextcloud:22-fpm
** clamAV version:** official clamav docker latest image from https://hub.docker.com/r/clamav/clamav version 0.104.1
List of activated apps:
Enabled:
- accessibility: 1.8.0
- activity: 2.15.0
- admin_audit: 1.12.0
- approval: 1.0.9
- bruteforcesettings: 2.2.0
- calendar: 2.3.4
- circles: 22.1.1
- cloud_federation_api: 1.5.0
- cms_pico: 1.0.16
- comments: 1.12.0
- contacts: 4.0.6
- contactsinteraction: 1.3.0
- dashboard: 7.2.0
- dav: 1.19.0
- deck: 1.5.5
- drawio: 1.0.1
- federatedfilesharing: 1.12.0
- federation: 1.12.0
- files: 1.17.0
- files_accesscontrol: 1.12.1
- files_antivirus: 3.2.2
- files_automatedtagging: 1.12.0
- files_fulltextsearch: 22.0.1
- files_markdown: 2.3.4
- files_pdfviewer: 2.3.1
- files_rightclick: 1.1.0
- files_sharing: 1.14.0
- files_trashbin: 1.12.0
- files_versions: 1.15.0
- files_videoplayer: 1.11.0
- firstrunwizard: 2.11.0
- flow_notifications: 1.2.0
- fulltextsearch: 22.0.1
- fulltextsearch_elasticsearch: 22.0.1
- groupfolders: 10.0.0
- impersonate: 1.9.0
- issuetemplate: 0.7.0
- logreader: 2.7.0
- lookup_server_connector: 1.10.0
- nextcloud_announcements: 1.11.0
- notifications: 2.10.1
- oauth2: 1.10.0
- onlyoffice: 7.2.0
- password_policy: 1.12.0
- photos: 1.4.0
- privacy: 1.6.0
- provisioning_api: 1.12.0
- recommendations: 1.1.0
- serverinfo: 1.12.0
- settings: 1.4.0
- sharebymail: 1.12.0
- spreed: 12.1.2
- support: 1.5.0
- survey_client: 1.10.0
- systemtags: 1.12.0
- tasks: 0.14.2
- text: 3.3.0
- theming: 1.13.0
- twofactor_backupcodes: 1.11.0
- updatenotification: 1.12.0
- user_external: 2.1.0
- user_status: 1.2.0
- viewer: 1.6.0
- weather_status: 1.2.0
- workflow_script: 1.7.0
- workflowengine: 2.4.0 Disabled:
- encryption
- files_external
- files_texteditor
- user_ldap
Nextcloud configuration:
relevant part of the configuration in Security -> Antivirus for files
Mode: ClamAV Daemon (Socket)
Socket: /run/clamav/clamd.sock
Stream Length: 26214400
File size limit for periodic background scans ...: -1
When infected files are found ...: Only log
Client configuration
Browser: irrelevant
Operating system: irrelevant
Logs
Nextcloud log (data/owncloud.log)
{"reqId":"YZTnUNxJpbDfhrut6YsDNwAAJAs","level":3,"time":"2021-11-17T11:28:16+00:00","remoteAddr":"91.16.153.169","user":"dietrich","app":"no app in context","method":"PUT","url":"/remote.php/webdav/ReaReg/eicarcom2.zip","message":"Virus Win.Test.EICAR_HDB-1 is detected in the file. Upload cannot be completed.","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36","version":"22.2.3.0","exception":{"Exception":"OCP\\Files\\InvalidContentException","Message":"Virus Win.Test.EICAR_HDB-1 is detected in the file. Upload cannot be completed.","Code":0,"Trace":[{"function":"OCA\\Files_Antivirus\\{closure}","class":"OCA\\Files_Antivirus\\AvirWrapper","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/3rdparty/icewind/streams/src/CallbackWrapper.php","line":119,"function":"call_user_func","args":[{"__class__":"Closure"}]},{"function":"stream_close","class":"Icewind\\Streams\\CallbackWrapper","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Storage/Local.php","line":575,"function":"fclose","args":[null]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":628,"function":"writeStream","class":"OC\\Files\\Storage\\Local","type":"->","args":["files/ReaReg/eicarcom2.zip.ocTransferId398789552.part",null,null]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":628,"function":"writeStream","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["files/ReaReg/eicarcom2.zip.ocTransferId398789552.part",null,null]},{"file":"/var/www/html/custom_apps/files_antivirus/lib/AvirWrapper.php","line":94,"function":"writeStream","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["files/ReaReg/eicarcom2.zip.ocTransferId398789552.part",null,null]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":628,"function":"writeStream","class":"OCA\\Files_Antivirus\\AvirWrapper","type":"->","args":["files/ReaReg/eicarcom2.zip.ocTransferId398789552.part",null,null]},{"file":"/var/www/html/custom_apps/files_accesscontrol/lib/StorageWrapper.php","line":320,"function":"writeStream","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["files/ReaReg/eicarcom2.zip.ocTransferId398789552.part",null,null]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/File.php","line":206,"function":"writeStream","class":"OCA\\FilesAccessControl\\StorageWrapper","type":"->","args":["files/ReaReg/eicarcom2.zip.ocTransferId398789552.part",null]},{"file":"/var/www/html/apps/dav/lib/Connector/Sabre/Directory.php","line":155,"function":"put","class":"OCA\\DAV\\Connector\\Sabre\\File","type":"->","args":[null]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":1098,"function":"createFile","class":"OCA\\DAV\\Connector\\Sabre\\Directory","type":"->","args":["eicarcom2.zip",null]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/CorePlugin.php","line":504,"function":"createFile","class":"Sabre\\DAV\\Server","type":"->","args":["ReaReg/eicarcom2.zip",null,null]},{"file":"/var/www/html/3rdparty/sabre/event/lib/WildcardEmitterTrait.php","line":89,"function":"httpPut","class":"Sabre\\DAV\\CorePlugin","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":472,"function":"emit","class":"Sabre\\DAV\\Server","type":"->","args":["method:PUT",[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":253,"function":"invokeMethod","class":"Sabre\\DAV\\Server","type":"->","args":[{"__class__":"Sabre\\HTTP\\Request"},{"__class__":"Sabre\\HTTP\\Response"}]},{"file":"/var/www/html/3rdparty/sabre/dav/lib/DAV/Server.php","line":321,"function":"start","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/apps/dav/appinfo/v1/webdav.php","line":83,"function":"exec","class":"Sabre\\DAV\\Server","type":"->","args":[]},{"file":"/var/www/html/remote.php","line":166,"args":["/var/www/html/apps/dav/appinfo/v1/webdav.php"],"function":"require_once"}],"File":"/var/www/html/custom_apps/files_antivirus/lib/AvirWrapper.php","Line":154,"CustomMessage":"--"},"id":"6194e75ddf5ac"}