An ID on the command line is decimal digits only (closes #185) #189

Merged
clawbot merged 2 commits from issue-185-decimal-ids into next 2026-10-14 03:06:35 +02:00
Collaborator

Implements #185.

files --collection, get, get-thumb and helper fix-missing-thumbnails --file read their ID with Number(), so 0x10 fetched file 16, 1e3 file 1000 and an empty string file 0, while --file abc was dropped without a word and the command exited 0.

parseID in src/cli-commands.ts now does the check for all four: the ID must be decimal digits that make a safe integer, or the command prints one line, Invalid file ID: ARG (Invalid collection ID: ARG for files), and exits 1. The fixer checks every --file ID before it opens the library, so one bad ID fails the whole command before any request. The README's CLI surface section says so.

The new tests run each command on a real client over a fake Ente server holding an empty account, and check that a refused ID sends no request. A good ID therefore ends in "not found" with exit 1; those tests show that the ID passed the check and reached the server.

  • Judgement call: the check still comes after the session is loaded, as before, so with no saved session a bad ID still gets "Not logged in" and exit 3.
  • Judgement call: the refused IDs in the tests also include 9007199254740992, one past the largest safe integer.
  • The two older tests of a non-numeric ID, which asserted the old message, are folded into the new ones.

Model: opus-5-5

Implements https://git.eeqj.de/sneak/quak/issues/185. `files --collection`, `get`, `get-thumb` and `helper fix-missing-thumbnails --file` read their ID with `Number()`, so `0x10` fetched file 16, `1e3` file 1000 and an empty string file 0, while `--file abc` was dropped without a word and the command exited 0. `parseID` in `src/cli-commands.ts` now does the check for all four: the ID must be decimal digits that make a safe integer, or the command prints one line, `Invalid file ID: ARG` (`Invalid collection ID: ARG` for `files`), and exits 1. The fixer checks every `--file` ID before it opens the library, so one bad ID fails the whole command before any request. The README's CLI surface section says so. The new tests run each command on a real client over a fake Ente server holding an empty account, and check that a refused ID sends no request. A good ID therefore ends in "not found" with exit 1; those tests show that the ID passed the check and reached the server. - Judgement call: the check still comes after the session is loaded, as before, so with no saved session a bad ID still gets "Not logged in" and exit 3. - Judgement call: the refused IDs in the tests also include 9007199254740992, one past the largest safe integer. - The two older tests of a non-numeric ID, which asserted the old message, are folded into the new ones. Model: opus-5-5
clawbot added the needs-review label 2026-10-14 02:25:15 +02:00
clawbot self-assigned this 2026-10-14 02:25:16 +02:00
clawbot added 2 commits 2026-10-14 02:25:17 +02:00
files --collection, get, get-thumb and helper fix-missing-thumbnails
--file must refuse 0x10, 1e3, 1.5, -1, an empty string, abc and an
integer past Number.MAX_SAFE_INTEGER with one line naming the argument,
and exit 1 before any request. A good ID goes on to the server. The
commands run on a real client over a fake Ente server holding an empty
account. The two older tests of a non-numeric ID are folded into these.

Model: opus-5-5
files --collection, get, get-thumb and helper fix-missing-thumbnails
--file read an ID with Number(), so 0x10 meant 16, 1e3 meant 1000 and
an empty string meant 0, and --file dropped an ID it could not read.
parseID in src/cli-commands.ts now takes an ID only when it is decimal
digits and a safe integer; anything else prints "Invalid file ID: ARG"
or "Invalid collection ID: ARG" and the command exits 1. The fixer
checks every --file ID before it opens the library, so one bad ID fails
the whole command before any request.

Model: opus-5-5
Author
Collaborator

Review passed.

Model: opus-5-5

Review passed. Model: opus-5-5
clawbot merged commit ab28d86aaa into next 2026-10-14 03:06:35 +02:00
clawbot deleted branch issue-185-decimal-ids 2026-10-14 03:06:36 +02:00
clawbot removed the needs-review label 2026-10-14 03:06:44 +02:00
Sign in to join this conversation.