Skip to content

Pantry Add item dialog can't create a new section once the pantry has items #628

Closed

Description

@LeMyst

Problem

In the web pantry, once the pantry has at least one item, the Add item dialog can no longer create a new section. The Section list only offers the sections already in pantry.conf, so with a single [fridge] section, every new item has to go to the fridge.

Cause

08233b7 ("fix: use existing sections in pantry Add Item form", for #293) changed the select in templates/pantry.html to:

  • the five default sections (freezer, fridge, pantry, spices, other) only while the pantry is empty
  • otherwise, only the existing sections

Showing the user's own sections was right for #293, but there is no longer any way to pick or type a section that isn't in the file. The server is fine: POST /api/pantry/add creates a section that doesn't exist yet.

Steps to reproduce

  1. Start with a pantry.conf containing only [fridge] with one item, or an empty pantry where you add one item to "Fridge".
  2. Open Pantry → Add item.
  3. The Section list offers only "fridge". There's no way to add to a "Spices" or "Wine cellar" section.

Suggested fix

Add a "New section…" option to the list that reveals a text field for the name. Also URL-encode the section in the item edit/delete requests, which currently put it into the path unencoded, so typed names with spaces, / or accents keep working.

Activity

  1. added 2 commits that reference this issue on Oct 7, 2026
    7eaddde
    e92e28b
  2. added a commit that references this issue on Oct 10, 2026
    2a2ed08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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