Superbalist / flysystem-google-cloud-storage

Flysystem Adapter for Google Cloud Storage
MIT License
265 stars 105 forks source link

Function getOptionsFromConfig() is not working #101

Closed drionix closed 5 years ago

drionix commented 5 years ago

After pulling my hair out for hours of debugging, i found out that getOptionsFromConfig() is not working as intended.

    protected function getOptionsFromConfig(Config $config)
    {
        $options = [];

        if ($visibility = $config->get('visibility')) {
            $options['predefinedAcl'] = $this->getPredefinedAclForVisibility($visibility);
        } else {
            // if a file is created without an acl, it isn't accessible via the console
            // we therefore default to private
            $options['predefinedAcl'] = $this->getPredefinedAclForVisibility(AdapterInterface::VISIBILITY_PRIVATE);
        }

        if ($metadata = $config->get('metadata')) {
            $options['metadata'] = $metadata;
        }

        return $options;
    }

Specifically in this part of the function

if ($visibility = $config->get('visibility')) {
        $options['predefinedAcl'] = $this->getPredefinedAclForVisibility($visibility);
}

This happens because $config->get('whatever') apparently always return NULL whether the settings key has been set or not, and therefore always equal to false in the if else condition.

Anybody know how to fix this??

drionix commented 5 years ago

Just found out that the problem lies in barryvdh/elfinder-flysystem-driver package and not this package's bug.