Skip to content

imogen album create "" makes an album no name can reach #43

Closed

Description

@ergofobe

Symptom

AlbumCommand::Create passes the name to the API as it stands, so an empty or
whitespace-only one is accepted and stored. The album that results is reachable only by id:
find_album refuses an empty reference (#38), and no non-empty reference matches an empty
name, so imogen album show, add, remove, delete and --album can never name it
again. album update --name "" does the same to an album that had a usable name.

imogen upload --album "$ALBUM" with the variable unset is now refused, which is #38 —
this is the other half, where the unusable name is written rather than read.

Reproduction

imogen album create ""          # or --name "   "
imogen album list               # a row with an empty NAME
imogen album show ""            # refused: an empty reference cannot pick one

Expected

An album name is trimmed and cannot be empty, on create and on update --name: refuse
with a message saying so, before anything reaches the wire, the way an empty reference is
refused when reading.

The lookup side already trims the stored name when comparing (see named_album in
src/context.rs), so a padded name is at least still findable; an empty one cannot be.

Affected repos

Only imogen-cli — the server accepts what it is sent, and nothing on the wire changes.
Whether the server should also refuse an empty album name is a separate question for
imogen-server.

Context

Found by review on the #38 PR (#42), which hardens reading a reference
that cannot pick an album and leaves writing one untouched.

Activity

  1. added
    bugSomething isn't working
    triagedHome repo decided, labelled, ready to bundle
    on Sep 16, 2026
  2. ergofobe commented on Sep 16, 2026

    @ergofobe
    OwnerAuthor

    Fixed in 9460959 (#44). context::album_name trims an album name and refuses an empty one, on album create and on album update --name, before anything reaches the wire — the mirror of the guard albums_for puts on reading a reference. It trims as well as refuses because named_album compares the stored name trimmed, so creation and lookup now settle on the same string; album_or_create already created under the trimmed name. On update the refusal runs before find_album, so nothing at all is sent. Four tests in commands/albums.rs cover both doors and both the empty and the padded name; the two refusal tests assert the stub recorded no calls.

    Whether the server should also refuse an empty album name is still open and belongs in imogen-server.

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

    bugSomething isn't workingtriagedHome repo decided, labelled, ready to bundle

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions