Skip to content

fix: [PR-1680] parse correct API field names for v2/images#251

Merged
sigmachirality merged 3 commits intomainfrom
fix/images-upload-api-field-names-and-dep-conflict
Feb 18, 2026
Merged

fix: [PR-1680] parse correct API field names for v2/images#251
sigmachirality merged 3 commits intomainfrom
fix/images-upload-api-field-names-and-dep-conflict

Conversation

@andreaanez
Copy link
Contributor

@andreaanez andreaanez commented Feb 18, 2026

Summary

  • url not upload_url: v2/images/{id}/parts returns url in the response — schema and upload code updated to match
  • sha256 not sha256_hash: v2/images/{id}/complete expects sha256 in the request body — schema and upload code updated to match
  • isFullwidthCodePoint is not a function crash: bun's symlink layout caused Node.js v24 to resolve is-fullwidth-code-point to v5.1.0 (ESM-only) from within cli-progress's string-width@4.2.3 (CJS). When CJS require()s an ESM module in Node 24, it returns the module namespace object rather than the default export, causing isFullwidthCodePoint(code) to throw. Fixed by pinning is-fullwidth-code-point@3.0.0 via overrides in package.json.

Test plan

  • sf images upload -f <file> --name <name> completes successfully end-to-end
  • Progress bar renders without crashing
  • Upload finalizes with a 200 response from the complete endpoint

🤖 Generated with Claude Code

…conflict in images upload

Three bugs fixed in `sf images upload`:

1. `partResponse.data.upload_url` → `.url`: the v2/images/{id}/parts endpoint
   returns `url`, not `upload_url` as the schema declared.

2. `sha256_hash` → `sha256`: the v2/images/{id}/complete endpoint expects the
   field named `sha256`, not `sha256_hash` as the schema declared. Schema updated
   to match both.

3. isFullwidthCodePoint runtime crash: bun's symlink layout caused Node.js (v24)
   to resolve `is-fullwidth-code-point` to v5.1.0 (ESM-only) from within
   `cli-progress`'s nested `string-width@4.2.3` (CJS). When CJS require()s an
   ESM module in Node 24 it gets the module namespace object, not the default
   export, so `isFullwidthCodePoint(code)` threw "not a function". Fixed by
   pinning `is-fullwidth-code-point` to 3.0.0 via package.json overrides and
   a clean bun install.

Also improves the complete-upload error message to use `completeResponse.error`
(already parsed by openapi-fetch) instead of re-reading the consumed response body.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@semanticdiff-com
Copy link

semanticdiff-com bot commented Feb 18, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  src/lib/images/upload.ts  48% smaller
  package.json  40% smaller
  bun.lock Unsupported file format

@andreaanez andreaanez changed the title fix: correct API field names and resolve is-fullwidth-code-point ESM conflict in images upload fix: correct API field names for v2 images API Feb 18, 2026
@sigmachirality sigmachirality changed the title fix: correct API field names for v2 images API fix: [PR-1680] parse correct API field names for v2/images Feb 18, 2026
sigmachirality and others added 2 commits February 17, 2026 19:06
The v2 API field names (sha256, url) differ from the generated schema
(sha256_hash, upload_url). Rather than modifying the generated schema,
the next commit switches sf images upload to raw fetch with hardcoded
types so it is not coupled to schema.ts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@sigmachirality sigmachirality force-pushed the fix/images-upload-api-field-names-and-dep-conflict branch from 83da58a to 04ef1de Compare February 18, 2026 03:14
@sigmachirality sigmachirality merged commit 091c584 into main Feb 18, 2026
1 check passed
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

Comments