Skip to content

Enhancement: add XDG_CACHE_HOME to _safe_cache_dir allowlist (Linux)Β #155

@tcconnally

Description

@tcconnally

Severity: 🟒 Low (Linux ergonomics)

renderer.py:99–102:

allowed_roots = [
    _Path.home() / ".perseus",
    _Path.home() / ".cache",
]

XDG-compliant Linux users with $XDG_CACHE_HOME set to a non-default location (e.g., ~/.local/cache) will have their cache_dir config rejected and fall back to ~/.perseus/cache.

Suggested fix

import os
xdg = os.environ.get("XDG_CACHE_HOME")
if xdg:
    allowed_roots.append(_Path(xdg).expanduser())

Acceptance criteria

  • Test: setting XDG_CACHE_HOME=/tmp/xdg and cache_dir=/tmp/xdg/perseus resolves to the configured path.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions