Problem/Motivation
The s3fs_domain and s3fs_domain_root fields are presented in UI as dependencies of s3fs_use_cname, but the code does not properly filter if the fields have values and s3fs_use_cname is disabled.
This can cause problems in a situation where use_cname was initially enabled, and then disabled at some point in the future, but the sub-field values were never cleared. Most notably, the S3 file paths will incorrectly reference domain_root or public folders when they should not.
Steps to reproduce
In the first test, configure these settings:
s3fs_use_cname = FALSE
s3fs_domain_root = 'private'
s3fs_public_folder = 's3fs-public'
Given that s3fs_use_cname is set to FALSE, the s3fs_domain_root value should be ignored and the s3fs_public_folder value should be prefixed to the S3 file path. However, what happens instead is the prefixing is skipped because s3fs_domain_root is not set to 'none' or 'root'.
In the second test, configure these settings:
s3fs_use_cname = FALSE
s3fs_domain_root = 'public'
s3fs_root_folder = 'dev'
Given that s3fs_use_cname is set to FALSE and s3fs_root_folder has a value, the s3fs_root_folder value should be prefixed to the S3 file path. However, similar to the example above, the prefixing is skipped because s3fs_domain_root is not set to 'none'.
Proposed resolution
See attached patch.
This fixes the bug that was introduced here in 7.x-2.x: https://git.drupalcode.org/project/s3fs/-/commit/b7bf6db2f096510c19bfc25...