Skip to content

Commit a28298f

Browse files
committed
fsspec.implementations.http: fix glob missing folders
1 parent 87f7f99 commit a28298f

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

fsspec/implementations/http.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ async def _glob(self, path, maxdepth=None, **kwargs):
448448

449449
ends_with_slash = path.endswith("/") # _strip_protocol strips trailing slash
450450
path = self._strip_protocol(path)
451-
append_slash_to_dirname = ends_with_slash or path.endswith("/**")
451+
append_slash_to_dirname = ends_with_slash or path.endswith("/**") or path.endswith("/*")
452452
idx_star = path.find("*") if path.find("*") >= 0 else len(path)
453453
idx_brace = path.find("[") if path.find("[") >= 0 else len(path)
454454

@@ -491,15 +491,13 @@ async def _glob(self, path, maxdepth=None, **kwargs):
491491
pattern = re.compile(pattern)
492492

493493
out = {
494-
p: info
494+
(
495+
p.rstrip("/")
496+
if not append_slash_to_dirname and info["type"] == "directory" and p.endswith("/")
497+
else p
498+
): info
495499
for p, info in sorted(allpaths.items())
496-
if pattern.match(
497-
(
498-
p + "/"
499-
if append_slash_to_dirname and info["type"] == "directory"
500-
else p
501-
)
502-
)
500+
if pattern.match(p.rstrip("/"))
503501
}
504502

505503
if detail:

0 commit comments

Comments
 (0)