Problem/Motivation

Currently the allow unchecked files action is not working because allowUncheckedFiles() returns false even though I enabled it. The configuration exported to clamav.settings.yaml was:

enabled: 1
outage_action: '1'
overridden_schemes: {  }
scan_mode: '0'
verbosity: 0
....

I think the quotes are messing it up.

Proposed resolution

We should make sure the exported value is an integer.

Remaining tasks

User interface changes

API changes

Data model changes

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

seanB created an issue. See original summary.

seanB’s picture

FileSize
669 bytes

Patch is attached.

Renrhaf’s picture

Status: Active » Reviewed & tested by the community

Same issue encountered, because of a strict comparison "===" between a string "1" and an integer 1 failing.
Patch fixes the issue by converting the string into an integer before the strict comparison.

andrewbelcher’s picture

Status: Reviewed & tested by the community » Needs work

Fixing this at the form level isn't really the right approach here. The correct place to make this adjustment is at the schema level, defining the config key as an integer and the schema API will handle the conversion.

However, this will not fix sites which are currently storing as a string, so I would also suggest the strict comparison would be better as a non strict - there's no need for strict as we control what the possible values are and the form API wont support any value combinations where strict would matter.

Will get a patch...

andrewbelcher’s picture

Status: Needs work » Needs review
FileSize
838 bytes

Here's a patch that fixes both schema and the comparison.

idebr’s picture

Status: Needs review » Reviewed & tested by the community

The schema change fixed config export and the logic in the \Drupal\clamav\Scanner::allowUncheckedFiles().

The config schema is broken in a few other places, so I have raised a followup to fix the remaining errors: #2976304: Fix config schema datatype errors

mcdruid’s picture

Status: Reviewed & tested by the community » Fixed
Related issues: +#2976304: Fix config schema datatype errors

Thanks everyone!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.