File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed
Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1+ Fix divergent behavior between ` MemoryStore ` and ` LocalStore ` ` list_prefix ` methods.
2+
3+ Both stores now consistently use string prefix matching (checking if keys start with the given prefix string),
4+ rather than ` LocalStore ` treating the prefix as a filesystem directory path. This ensures consistent
5+ behavior across different store implementations and aligns with the documented behavior of ` list_prefix ` .
Original file line number Diff line number Diff line change @@ -290,11 +290,14 @@ async def list(self) -> AsyncIterator[str]:
290290
291291 async def list_prefix (self , prefix : str ) -> AsyncIterator [str ]:
292292 # docstring inherited
293+ # Use string prefix matching to be consistent with MemoryStore behavior.
294+ # The prefix should match keys as strings, not as filesystem paths.
293295 to_strip = self .root .as_posix () + "/"
294- prefix = prefix .rstrip ("/" )
295- for p in (self .root / prefix ).rglob ("*" ):
296+ for p in list (self .root .rglob ("*" )):
296297 if p .is_file ():
297- yield p .as_posix ().replace (to_strip , "" )
298+ key = p .as_posix ().replace (to_strip , "" )
299+ if key .startswith (prefix ):
300+ yield key
298301
299302 async def list_dir (self , prefix : str ) -> AsyncIterator [str ]:
300303 # docstring inherited
You can’t perform that action at this time.
0 commit comments