nextcloud / files_antivirus

👾 Antivirus app for Nextcloud Files
https://apps.nextcloud.com/apps/files_antivirus
GNU Affero General Public License v3.0
84 stars 35 forks source link

Only scan user files #2 #205

Closed kesselb closed 3 years ago

kesselb commented 3 years ago

Summary: Uploading a file via web client is slow when files_antivirus is enabled

When investigation the above question I run into some weird states. My knowledge about this app is low. Review carefully.

A file uploaded in chunks is assembled on the server again by a move operation (done by the clients).

https://github.com/nextcloud/files_antivirus/blob/e888f598f93f9864c509f19e6f1a32d79186b033/lib/Sabre/PropfindPlugin.php#L66-L71

Is a plugin for the move operation. It's possible to configure a file size limit av_max_file_size for the background scanner. For some reason this value is also taken into account when moving the assembled file to the final destination. If the size of the assembled file is bigger than av_max_file_size dont' scan. Unfortunately the default is -1 and the above condition will evaluate to true and disable the scan.

Example: Alice uploads a file with 50 MB (6348800 bytes)

Before After
av_max_file_size -1 [x] chunks scanned
[] assembled file scanned
[ ] chunks scanned
[x] assembled file scanned
av_max_file_size 104857600 [x] chunks scanned
[x] assembled file scanned
[ ] chunks scanned
[x] assembled file scanned