Skip to content

Commit

Permalink
Merge a66e6ff into 3ace301
Browse files Browse the repository at this point in the history
  • Loading branch information
potter420 committed May 15, 2019
2 parents 3ace301 + a66e6ff commit 587ce6f
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions zarr/storage.py
Expand Up @@ -2183,11 +2183,12 @@ def update(self, *args, **kwargs):

def listdir(self, path=None):
path = normalize_storage_path(path)
sep = '_' if path=='' else '/'
keys = self.cursor.execute(
'''
f'''
SELECT DISTINCT SUBSTR(m, 0, INSTR(m, "/")) AS l FROM (
SELECT LTRIM(SUBSTR(k, LENGTH(?) + 1), "/") || "/" AS m
FROM zarr WHERE k LIKE (? || "_%")
FROM zarr WHERE k LIKE (? || "{sep}%")
) ORDER BY l ASC
''',
(path, path)
Expand All @@ -2213,7 +2214,7 @@ def rmdir(self, path=None):
if path:
with self.lock:
self.cursor.execute(
'DELETE FROM zarr WHERE k LIKE (? || "_%")', (path,)
'DELETE FROM zarr WHERE k LIKE (? || "/%")', (path,)
)
else:
self.clear()
Expand Down

0 comments on commit 587ce6f

Please sign in to comment.