mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
16edcbdd5b
Both write_file and edit_files use atomic writes (write to temp file, then rename). Since rename operates on directory entries, it replaces symlinks with regular files instead of writing through the link to the target. Add resolveSymlink() that uses afero.Lstater/LinkReader to resolve symlink chains (up to 10 levels) before the atomic write. Both writeFile and editFile resolve the path before any filesystem operations, matching the behavior of 'echo content > symlink'. Gracefully no-ops on filesystems that don't support symlinks (e.g. MemMapFs used in existing tests).