lib.ec.secret_store.KvFile: Fail get() on directories
A directory node of the store, the root included, stats as a directory, but a get on it falls through to the key lookup below its parent and fails with a FileNotFoundError naming a path the caller never asked for: get() on the root fails with an empty name, get() on a branch with its parent's compound path. Raise IsADirectoryError from _get() when the path is a directory on the host, after the compound and the blob lookups, so get() and stat() agree: a directory stats as FT_DIR and refuses a get. Assisted-by: unsloth/Qwen3.8-27B-GGUF:Q4_K_M with pi.dev v1.5.0 Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
e96bfca0e1
commit
fae3390a50
1 changed files with 13 additions and 0 deletions
|
|
@ -215,6 +215,8 @@ class KvFile(Base):
|
|||
secret_path = f'/{config_path}{BLOB_SUFFIX}'
|
||||
if await self.__ctx.file_exists(secret_path):
|
||||
return await self.__ctx.get(secret_path)
|
||||
if await self.__ctx.is_dir(f'/{config_path}'):
|
||||
raise IsADirectoryError(errno.EISDIR, f'get: {path}')
|
||||
if '/' not in config_path:
|
||||
raise FileNotFoundError(path)
|
||||
compound, key = config_path.rsplit('/', 1)
|
||||
|
|
|
|||
Loading…
Reference in a new issue