The PseudoDirEntry class caches the results of is_dir(), is_file(), and is_symlink() methods but ignores the follow_symlinks parameter, which could return incorrect results if called with different parameter values.
The caching doesn't account for the follow_symlinks parameter. If you call:
entry.is_dir(follow_symlinks=True) → caches result
entry.is_dir(follow_symlinks=False) → returns cached result from (1), which may be wrong
Proposed Solution
Either:
Remove the parameter if it's not needed
Cache based on the parameter value: self._is_dir[follow_symlinks]
Remove caching entirely (probably simplest)
Impact
Medium - Could cause incorrect behavior with symlinks if follow_symlinks is used with different values.
# PseudoDirEntry caching ignores follow_symlinks parameter
**Priority:** Medium
**Component:** fs.py
**Type:** Bug
## Description
The `PseudoDirEntry` class caches the results of `is_dir()`, `is_file()`, and `is_symlink()` methods but ignores the `follow_symlinks` parameter, which could return incorrect results if called with different parameter values.
## Location
`curateipsum/fs.py:31-63`
## Current Code
```python
def is_dir(self, follow_symlinks: bool = True) -> bool:
if self._is_dir is None:
self._is_dir = os.path.isdir(self.path)
return self._is_dir
```
## Problem
The caching doesn't account for the `follow_symlinks` parameter. If you call:
1. `entry.is_dir(follow_symlinks=True)` → caches result
2. `entry.is_dir(follow_symlinks=False)` → returns cached result from (1), which may be wrong
## Proposed Solution
Either:
1. Remove the parameter if it's not needed
2. Cache based on the parameter value: `self._is_dir[follow_symlinks]`
3. Remove caching entirely (probably simplest)
## Impact
**Medium** - Could cause incorrect behavior with symlinks if follow_symlinks is used with different values.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
PseudoDirEntry caching ignores follow_symlinks parameter
Priority: Medium
Component: fs.py
Type: Bug
Description
The
PseudoDirEntryclass caches the results ofis_dir(),is_file(), andis_symlink()methods but ignores thefollow_symlinksparameter, which could return incorrect results if called with different parameter values.Location
curateipsum/fs.py:31-63Current Code
Problem
The caching doesn't account for the
follow_symlinksparameter. If you call:entry.is_dir(follow_symlinks=True)→ caches resultentry.is_dir(follow_symlinks=False)→ returns cached result from (1), which may be wrongProposed Solution
Either:
self._is_dir[follow_symlinks]Impact
Medium - Could cause incorrect behavior with symlinks if follow_symlinks is used with different values.