-
Notifications
You must be signed in to change notification settings - Fork 17
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
1 parent
c219b9c
commit 1809e10
Showing
3 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters