Skip to content

GET /api/recipes sends the absolute path of every recipe #638

Closed

Description

@LeMyst

GET /api/recipes answers with the recipe tree, and every node carries the file's absolute path on the server, twice: as path, and as recipe.source.path.

{"children":{"2 Day Plan":{"name":"2 Day Plan","path":"/home/<user>/recipes/2 Day Plan.menu",
  "recipe":{"source":{"path":"/home/<user>/recipes/2 Day Plan.menu","source_type":"Path"}, …

That tells any client the server's directory layout and, usually, the name of the account it runs as. The endpoint is a read open to everyone: with sign-in on, visitors who are not signed in get it, and it is on the --recipes-only allowlist, so guests limited to recipes get it too. Nothing needs the absolute path. The only client in the repo, the recipe picker (static/js/src/picker.js, flattenTree), strips the root's path off again to get relative ones.

It started with be92001 ("refactor: wip reming cooklang-fs"). Before it, the endpoint returned the recipes' names relative to the collection; since then it serialises cooklang_find's tree as is. docs/api.md documents the absolute paths (/absolute/path/to/seed/...).

Proposed fix

Make every path and recipe.source.path in the answer relative to the recipe directory (Breakfast/Easy Pancakes.cook), with the root as "". The picker keeps working unchanged. Any outside client that used the absolute paths would need to treat them as relative to the collection: that is the one visible change.

The Preferences page has a similar problem, tracked in #637.

Activity

  1. self-assigned this
    on Oct 7, 2026
  2. added a commit that references this issue on Oct 9, 2026
    457e3f7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions