Skip to content

Fix: resolve short Trello board ID to full 24-char hex ID during init#3

Open
gonewest818 wants to merge 1 commit into
OG-Drizzles:mainfrom
gonewest818:fix-client-errors-updating-labels
Open

Fix: resolve short Trello board ID to full 24-char hex ID during init#3
gonewest818 wants to merge 1 commit into
OG-Drizzles:mainfrom
gonewest818:fix-client-errors-updating-labels

Conversation

@gonewest818
Copy link
Copy Markdown

When trache init is called with --board-url, the board ID extracted from the URL (e.g. aBcDeFgH from https://trello.com/b/aBcDeFgH/my-board) is a short ID.

And Trello accepts short IDs in URL paths for GET operations (GET /1/boards/aBcDeFgH), but rejects them in idBoard parameter values for POST/PUT operations such as creating labels (POST /1/labels) or creating lists (POST /1/lists).

The --board-url / --board-id code path only saved board_obj.name and left the short ID in config.board_id. This caused a confusing partial-failure pattern: reading boards, cards, and lists worked fine, but label creation and list creation failed with 400 {"message":"Invalid id"}.

The fix is, after fetching the board during init, save the full 24-char hex ID from the API response back to config.board_id.

When `trache init` is called with `--board-url`, the board ID extracted
from the URL (e.g. `aBcDeFgH` from `https://trello.com/b/aBcDeFgH/my-board`)
is a short ID. Trello accepts short IDs in URL paths for GET operations
(`GET /1/boards/aBcDeFgH`), but rejects them in `idBoard` parameter
values for POST/PUT operations such as creating labels
(`POST /1/labels`) or creating lists (`POST /1/lists`).

The `--new` code path already resolved this by saving `board_obj.id`,
but the `--board-url` / `--board-id` code path only saved
`board_obj.name` and left the short ID in `config.board_id`.

This caused a confusing partial-failure pattern: reading boards, cards,
and lists worked fine, but label creation and list creation failed with
`400 {"message":"Invalid id"}`.

After fetching the board during init, save the full 24-char hex ID from
the API response back to `config.board_id`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants