flysystem-google-cloud-storage icon indicating copy to clipboard operation
flysystem-google-cloud-storage copied to clipboard

has function does not return true for directories

Open MordiSacks opened this issue 5 years ago • 2 comments

the has function

Superbalist\Flysystem\GoogleStorage::has()

Does not return true for directories.

MordiSacks avatar Dec 23 '19 08:12 MordiSacks

Ok, found a solution

    public function has($path)
    {
        if ($this->getObject($path)->exists()) {
            return true;
        }

        return count(array_filter($this->listContents($path), function ($item) use ($path) {
                return $item['path'] === $path;
            })) === 1;
    }

MordiSacks avatar Dec 23 '19 09:12 MordiSacks

fixed by #107

MordiSacks avatar Dec 23 '19 09:12 MordiSacks