fix: symlink guard placement, fetch_all_assets raw count, config TOCTOU (#31)
executor.py: - Move islink check into _safe_person_dir on the raw path, before realpath resolves it; the previous check at the rmtree site was unreachable dead code because realpath already followed any symlink immich_api.py / jobs.py: - fetch_all_assets now returns (assets, total_raw) where total_raw is the item count seen before non-dict filtering; callers use it for MIN_FACE_COUNT guard and display so transient non-dict API items can't incorrectly skip people - Add WARNING when pagination stops because a page had items but all were non-dict config.py: - Cache _data_cfg.exists() in _data_cfg_exists so the dual-config warning and config_file selection always read from the same stat() result; previously two calls created a TOCTOU window where log and code could disagree Bump version to 0.5.7
This commit is contained in:
+3
-2
@@ -123,14 +123,15 @@ class _Config:
|
||||
# Prefer DATA_DIR/.immich_config.json (volume-safe in Docker) and fall back
|
||||
# to the legacy CWD path so existing installations continue to work.
|
||||
_data_cfg = Path(self.DATA_DIR) / ".immich_config.json"
|
||||
if _data_cfg.exists() and _LEGACY_CONFIG_FILE.exists():
|
||||
_data_cfg_exists = _data_cfg.exists()
|
||||
if _data_cfg_exists and _LEGACY_CONFIG_FILE.exists():
|
||||
logging.warning(
|
||||
"Two config files found: %s and %s — using %s. Remove the legacy file to silence this.",
|
||||
_data_cfg,
|
||||
_LEGACY_CONFIG_FILE,
|
||||
_data_cfg,
|
||||
)
|
||||
config_file = _data_cfg if _data_cfg.exists() else _LEGACY_CONFIG_FILE
|
||||
config_file = _data_cfg if _data_cfg_exists else _LEGACY_CONFIG_FILE
|
||||
if config_file.exists():
|
||||
try:
|
||||
data = json.loads(config_file.read_text())
|
||||
|
||||
Reference in New Issue
Block a user