Skip to main content

Module link_file_check

Module link_file_check 

Source
Expand description

fs.link_file_check: whether a file a message names is in its author’s folders, so a window can draw it as a link or as a muted word (docs/specs/SPEC_LINKS_ON_EVERYTHING_2026_11_20.md §5, §6.4).

Built to be safe on text full of hostile paths:

  • Read-only. It looks whether a file exists and reads nothing.
  • Canonicalises before it compares. Symlinks, .., junctions and short names are resolved first, and the result, not the written path, is compared with the author’s folder.
  • Rate-limited per author and overall, so text full of paths can’t be used to probe the disk.
  • Says nothing about what is outside. A path outside the author’s folders answers outside whether or not anything is there, and no answer names a host path.

A container agent’s paths are resolved by agent_media_files::resolve, as a click on them is. Any other agent’s are resolved against the pane’s working directory.

Structs§

Counts 🔒
Asks counted in the current window, per author and overall.

Constants§

FOLDER_WORDS 🔒
FOUND 🔒
LIMITED 🔒
LIMITED_WORDS 🔒
MAX_HOPS 🔒
How many links in a row are followed by hand.
MISSING 🔒
NOT_FOUND_WORDS 🔒
OUTSIDE 🔒
OUTSIDE_WORDS 🔒
OVERALL 🔒
PER_AUTHOR 🔒
WINDOW 🔒

Functions§

answer 🔒
check_in_container 🔒
A file named in a message of the container agent whose pane is meta, found by the same rules a click on it uses.
check_in_folder 🔒
A file named in a message of a host agent whose pane works in cwd: found when it is a file inside that folder.
collapse 🔒
path with . and .. taken out, without touching the disk; None when a .. would leave its root.
counts 🔒
dangling_link_leaves 🔒
Whether path, which is not there, would lead out of the folder (inside: the folder as written and as resolved) were it there: what a link on the way points at is followed whether it is there or not, so that a path through a link that leaves the folder answers as one that leaves it does, and what lies outside is not told by whether a file is there.
fs_link_file_check 🔒
fs.link_file_check.
leads_to 🔒
Where path would lead if it were there: every link on the way followed (a dangling one too, by what it says), a .. taken from where the link before it leads, and what is not there left as written. None when links go round.