Names quak builds from server data can be over 255 bytes: backup-metadata album folders, quak get defaults, long extensions in a save path #205

Open
opened 2026-10-16 02:06:43 +02:00 by clawbot · 1 comment
Collaborator

Severity: low

Where: names built from an album name or a file title, outside the album folders and links of quak backup:

  • runMetadataBackup in src/metadata-backup.ts: the album folder ID-NAME (mkdirSync(colDir, ...), outside any try);
  • originalName and thumbnailName in src/cli-output.ts: the default output names of quak get and quak get-thumb;
  • downloadFile and downloadThumbnail in src/download/index.ts: the same defaults for a library caller that passes no outPath;
  • safeExtension in src/filename.ts: the extension of the save path YYYY-MM-DD.FILEID.EXT, which has no length limit.

Problem: a file system refuses a file name over 255 bytes. An album name of that length makes backup-metadata stop at that album with quak: ENAMETOOLONG: ... and exit 1, before the albums after it and before any file's metadata is written. A title of that length makes quak get and quak get-thumb fail unless --out is given; thumb_ before a title of 250 bytes, a name its own system accepted, is already too long. A title whose extension is a long run of letters and digits (b. followed by 300 es) gives a save path whose name is over 255 bytes, so quak backup records that original as failed on every run and never stores it. #204 fixes this for the album folders and links of quak backup and adds shortenToBytes and MAX_NAME_BYTES to src/filename.ts; these names were left out of that change.

Done when:

  • the album folder of backup-metadata and the default names of quak get, quak get-thumb, downloadFile and downloadThumbnail are cut short with shortenToBytes so that each fits in MAX_NAME_BYTES with everything added to it (ID-, thumb_), keeping the extension when it fits;
  • safeExtension gives .bin for an extension of more than 16 letters and digits, as it does for one holding anything else, and the README's "Backup layout" says so;
  • tests: a 300-byte album name for backup-metadata, a 300-byte title for quak get and quak get-thumb, and the b. plus 300 es title for quak backup, each checking the name written and the exit code.

Starts after #204 is on next.

Model: opus-5-5

Severity: low **Where:** names built from an album name or a file title, outside the album folders and links of `quak backup`: - `runMetadataBackup` in `src/metadata-backup.ts`: the album folder `ID-NAME` (`mkdirSync(colDir, ...)`, outside any `try`); - `originalName` and `thumbnailName` in `src/cli-output.ts`: the default output names of `quak get` and `quak get-thumb`; - `downloadFile` and `downloadThumbnail` in `src/download/index.ts`: the same defaults for a library caller that passes no `outPath`; - `safeExtension` in `src/filename.ts`: the extension of the save path `YYYY-MM-DD.FILEID.EXT`, which has no length limit. **Problem:** a file system refuses a file name over 255 bytes. An album name of that length makes `backup-metadata` stop at that album with `quak: ENAMETOOLONG: ...` and exit 1, before the albums after it and before any file's metadata is written. A title of that length makes `quak get` and `quak get-thumb` fail unless `--out` is given; `thumb_` before a title of 250 bytes, a name its own system accepted, is already too long. A title whose extension is a long run of letters and digits (`b.` followed by 300 `e`s) gives a save path whose name is over 255 bytes, so `quak backup` records that original as failed on every run and never stores it. https://git.eeqj.de/sneak/quak/pulls/204 fixes this for the album folders and links of `quak backup` and adds `shortenToBytes` and `MAX_NAME_BYTES` to `src/filename.ts`; these names were left out of that change. **Done when:** - the album folder of `backup-metadata` and the default names of `quak get`, `quak get-thumb`, `downloadFile` and `downloadThumbnail` are cut short with `shortenToBytes` so that each fits in `MAX_NAME_BYTES` with everything added to it (`ID-`, `thumb_`), keeping the extension when it fits; - `safeExtension` gives `.bin` for an extension of more than 16 letters and digits, as it does for one holding anything else, and the README's "Backup layout" says so; - tests: a 300-byte album name for `backup-metadata`, a 300-byte title for `quak get` and `quak get-thumb`, and the `b.` plus 300 `e`s title for `quak backup`, each checking the name written and the exit code. Starts after https://git.eeqj.de/sneak/quak/pulls/204 is on `next`. Model: opus-5-5
clawbot added this to the 1.0.0 milestone 2026-10-16 02:06:43 +02:00
clawbot changed title from `backup-metadata`, `quak get` and `quak get-thumb` build names from server data that can be over 255 bytes to Names quak builds from server data can be over 255 bytes: `backup-metadata` album folders, `quak get` defaults, long extensions in a save path 2026-10-16 02:23:44 +02:00
Author
Collaborator

Plan. Ready to start: the change it builds on (#204) is on next.

  • src/filename.ts, whose doc covers file names from server data and already holds shortenToBytes and MAX_NAME_BYTES, gets one function that shortens a name to fit in a number of bytes while keeping its extension when the extension fits (cut short otherwise). withID in uniqueNames in src/backup.ts does the same inside its own rule. The new function is written so withID can call it, and withID does so. safeExtension gives .bin for an extension of more than 16 letters and digits.
  • runMetadataBackup in src/metadata-backup.ts: the album folder is ID- plus the name shortened to fit MAX_NAME_BYTES. The ID alone keeps folders apart, so no further rule is needed.
  • originalName and thumbnailName in src/cli-output.ts, and the defaults in downloadFile and downloadThumbnail in src/download/index.ts: the default names are shortened with the new function, thumb_ included in the count.
  • README "Backup layout" for the extension rule, and the quak get and backup-metadata texts where they describe the names.
  • Tests as the issue says.

Model: opus-5-5

Plan. Ready to start: the change it builds on (https://git.eeqj.de/sneak/quak/pulls/204) is on `next`. - `src/filename.ts`, whose doc covers file names from server data and already holds `shortenToBytes` and `MAX_NAME_BYTES`, gets one function that shortens a name to fit in a number of bytes while keeping its extension when the extension fits (cut short otherwise). `withID` in `uniqueNames` in `src/backup.ts` does the same inside its own rule. The new function is written so `withID` can call it, and `withID` does so. `safeExtension` gives `.bin` for an extension of more than 16 letters and digits. - `runMetadataBackup` in `src/metadata-backup.ts`: the album folder is `ID-` plus the name shortened to fit `MAX_NAME_BYTES`. The ID alone keeps folders apart, so no further rule is needed. - `originalName` and `thumbnailName` in `src/cli-output.ts`, and the defaults in `downloadFile` and `downloadThumbnail` in `src/download/index.ts`: the default names are shortened with the new function, `thumb_` included in the count. - README "Backup layout" for the extension rule, and the `quak get` and `backup-metadata` texts where they describe the names. - Tests as the issue says. Model: opus-5-5
Sign in to join this conversation.