-
Notifications
You must be signed in to change notification settings - Fork 1
Add maximum scan size setting #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
3bfd4d4 to
ee49bb3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a configurable maximum scan size setting to replace the hardcoded file size limit. Users can now set a custom maximum file size (in MB) for virus scanning through the admin interface.
- Replaces hardcoded 1GB file size limit with configurable setting
- Adds admin UI form field for maximum scan size configuration
- Updates error messages to use the configurable limit instead of hardcoded values
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| templates/admin.php | Adds form input field for maximum scan size setting |
| src/admin-settings.js | Includes max scan size in form submission data |
| lib/Settings/VaasAdmin.php | Provides max scan size value to admin template |
| lib/Service/VerdictService.php | Replaces hardcoded limit with configurable setting |
| lib/Service/ScanService.php | Updates error message to use configurable limit |
| lib/Controller/SettingsController.php | Handles saving of max scan size setting with validation |
| lib/Controller/ScanController.php | Updates error message to use configurable limit |
| tests/bats/functionality-parallel.bats | Adjusts test file size to match new default limit |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
| } | ||
| if ((int)$maxScanSize < 1) { | ||
| return new JSONResponse(['status' => 'error', 'message' => 'Invalid max scan size: ' . $maxScanSize]); |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validation only checks for values less than 1, but doesn't handle the case where maxScanSize is null or empty string. This could cause unexpected behavior when casting to int.
| return new JSONResponse(['status' => 'error', 'message' => 'Invalid max scan size: ' . $maxScanSize]); | |
| if ($maxScanSize === null || $maxScanSize === '' || !is_numeric($maxScanSize) || (int)$maxScanSize < 1) { | |
| return new JSONResponse(['status' => 'error', 'message' => 'Invalid max scan size: ' . var_export($maxScanSize, true)]); |
| * @return bool | ||
| */ | ||
| public static function isFileTooLargeToScan(string $path): bool { | ||
| public function isFileTooLargeToScan(string $path): bool { |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changing this method from static to instance method is a breaking change that could cause errors in other parts of the codebase that call VerdictService::isFileTooLargeToScan() statically.
| <td class="input_field"><input id="notify_mails" type="text" name="notify_mails" value="<?php p($_['notifyMail']); ?>"/></td> | ||
| </tr> | ||
| <tr class="max-scan-size"> | ||
| <td><div title="<?php p($l->t('The maximum scan size for files to be scanned in MB. Files above this limit are tagged as “Won\'t Scan”.'));?>" class="visible"><label for="max-scan-size"><?php p($l->t('Maximum scan size'));?></label></div></td> |
Copilot
AI
Aug 21, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The escaped single quote in "Won't Scan" should use proper PHP string escaping. Consider using double quotes for the outer string to avoid confusion.
| <td><div title="<?php p($l->t('The maximum scan size for files to be scanned in MB. Files above this limit are tagged as “Won\'t Scan”.'));?>" class="visible"><label for="max-scan-size"><?php p($l->t('Maximum scan size'));?></label></div></td> | |
| <td><div title="<?php p($l->t("The maximum scan size for files to be scanned in MB. Files above this limit are tagged as “Won't Scan”."));?>" class="visible"><label for="max-scan-size"><?php p($l->t('Maximum scan size'));?></label></div></td> |
* fix: correct syntax error in ScanService.php for constant declaration for PHP < 8.3 (#227) * chore(deps): update dependency webpack-dev-server to v5.2.2 (#225) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update all non-major dependencies (#231) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update dependency psalm/phar to v6.13.0 (#232) Co-authored-by: Renovate Bot <[email protected]> * chore(deps): update all non-major dependencies (#233) Co-authored-by: Renovate Bot <[email protected]> * Add a quicker way for development with a local Nextcloud server and the app code changeable inside this server (#234) * Add Nextclouds worklfow templates and apply Nextcloud coding style (#235) * Add maximum scan size setting for file uploads (#236) * Devcontainer and Workflow Performance (#237) - Faster local development in devcontainer - Add Make stages for local fast developing as well as unit and bats tests - Remove unmaintained files from old debugging sessions` - Cleanup unused files and bundle utility scripts * Settings improvements (#238) - Add button to test current vaas configuration - Rename app settings to be more intuitive * Add additional settings (#239) - Control scan timeout - Control usage of cache - Control usage of hash lookup * Refactor logging messages and remove redundant debug statements (#240) * Update README with development environment setup instructions (#241) * Remove unused settings (#242) - Malicious file notifications summary - Scan only new files * Add make target for production like local setup (#243) * Outsource file scan actions (#244) --------- Co-authored-by: vaas-bot <[email protected]> Co-authored-by: Renovate Bot <[email protected]>
* fix: correct syntax error in ScanService.php for constant declaration for PHP < 8.3 (#227) * Add a quicker way for development with a local Nextcloud server and the app code changeable inside this server (#234) * Add Nextclouds worklfow templates and apply Nextcloud coding style (#235) * Add maximum scan size setting for file uploads (#236) * Devcontainer and Workflow Performance (#237) - Faster local development in devcontainer - Add Make stages for local fast developing as well as unit and bats tests - Remove unmaintained files from old debugging sessions` - Cleanup unused files and bundle utility scripts * Settings improvements (#238) - Add button to test current vaas configuration - Rename app settings to be more intuitive * Add additional settings (#239) - Control scan timeout - Control usage of cache - Control usage of hash lookup * Refactor logging messages and remove redundant debug statements (#240) * Update README with development environment setup instructions (#241) * Remove unused settings (#242) - Malicious file notifications summary - Scan only new files * Add make target for production like local setup (#243) * Outsource file scan actions (#244)
No description provided.