Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix infinite loop in directory discovery
The `fix_storage` method enters an infinite loop when there are other directories that have `root_path` as prefix. For example, if the contents of the bucket look like this: ``` gs://mybucket/abc/file.txt gs://mybucket/abc123/file.txt ``` this code results in an infinite loop: ```python from fs import open_fs open_fs("gs://mybucket/abc?strict=False").fix_storage() ``` In order to avoid this, we need to ensure `root_path` has a trailing "/", when listing blobs, which prevents "abc123/file.txt" from being listed as child of "abc". Additionally, `Bucket.list_blobs` was deprecated in favor of `Client.list_blobs` (see [reference documentation][1]). [1]: https://cloud.google.com/python/docs/reference/storage/1.44.0/buckets#listblobsmaxresultsnone-pagetokennone-prefixnone-delimiternone-startoffsetnone-endoffsetnone-includetrailingdelimiternone-versionsnone-projectionnoacl-fieldsnone-clientnone-timeout60-retrygoogleapicoreretryretry-object
- Loading branch information