ID arguments accept 0x10, 1e3, 1.5 and an empty string, and --file drops IDs it cannot read #185

Closed
opened 2026-10-14 01:31:48 +02:00 by clawbot · 1 comment
Collaborator

Problem

The commands that take an ID read it with Number() and accept anything that comes out finite (src/cli-commands.ts):

  • quak get 0x10 downloads file 16; quak get 1e3 downloads file 1000; quak get "" and quak get " " look up file 0; quak get 1.5 looks up file 1.5. The same holds for get-thumb and files --collection.
  • quak helper fix-missing-thumbnails --file abc drops abc without a word, fixes nothing and exits 0, so the user believes it worked.

Definition of done

  • get, get-thumb, files --collection and helper fix-missing-thumbnails --file accept an ID only when it is written as decimal digits and is a safe integer.
  • Anything else prints one line, Invalid file ID: ARG (or Invalid collection ID: ARG), and exits 1 before any request. For --file, one bad ID fails the whole command and nothing is fixed.
  • One small function does the check for all four.
  • Tests for each command: a good ID, and 0x10, 1e3, 1.5, -1, an empty string and abc.

Model: opus-5-5

## Problem The commands that take an ID read it with `Number()` and accept anything that comes out finite (`src/cli-commands.ts`): - `quak get 0x10` downloads file 16; `quak get 1e3` downloads file 1000; `quak get ""` and `quak get " "` look up file 0; `quak get 1.5` looks up file 1.5. The same holds for `get-thumb` and `files --collection`. - `quak helper fix-missing-thumbnails --file abc` drops `abc` without a word, fixes nothing and exits 0, so the user believes it worked. ## Definition of done - `get`, `get-thumb`, `files --collection` and `helper fix-missing-thumbnails --file` accept an ID only when it is written as decimal digits and is a safe integer. - Anything else prints one line, `Invalid file ID: ARG` (or `Invalid collection ID: ARG`), and exits 1 before any request. For `--file`, one bad ID fails the whole command and nothing is fixed. - One small function does the check for all four. - Tests for each command: a good ID, and `0x10`, `1e3`, `1.5`, `-1`, an empty string and `abc`. Model: opus-5-5
clawbot added this to the 1.0.0 milestone 2026-10-14 01:33:14 +02:00
Author
Collaborator

Built in #189: one check in src/cli-commands.ts for all four commands; a bad --file ID now fails the fixer before it opens the library.

Model: opus-5-5

Built in https://git.eeqj.de/sneak/quak/pulls/189: one check in `src/cli-commands.ts` for all four commands; a bad `--file` ID now fails the fixer before it opens the library. Model: opus-5-5
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sneak/quak#185