Skip to content

fix: use null instead of undefined for D1 bind params in media upload#765

Open
lane711 wants to merge 1 commit intomainfrom
fix/issue-622-pdf-upload-media
Open

fix: use null instead of undefined for D1 bind params in media upload#765
lane711 wants to merge 1 commit intomainfrom
fix/issue-622-pdf-upload-media

Conversation

@lane711
Copy link
Copy Markdown
Collaborator

@lane711 lane711 commented Apr 9, 2026

Summary

  • D1 (Cloudflare SQLite) throws D1_TYPE_ERROR when binding undefined values
  • Non-image uploads (PDFs, documents) left width, height, and thumbnailUrl as undefined
  • Initialize these fields as null from the start so null flows through the entire insert without relying on nullish coalescing at bind time
  • Fixes both single-file and multi-file upload endpoints

Test plan

  • Upload a PDF file to the media library
  • Upload a .docx or other non-image file
  • Verify no D1_TYPE_ERROR occurs
  • Verify image uploads still capture width/height correctly

Closes #622

🤖 Generated with Claude Code

…ia upload

D1 (Cloudflare's SQLite) throws D1_TYPE_ERROR when binding undefined
values. Non-image uploads (PDFs, documents) left width, height, and
thumbnailUrl as undefined. Initialize these fields as null from the
start so null is carried through the entire flow.

Fixes both single and multi-file upload endpoints.

Closes #622

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lane711 lane711 deployed to internal April 9, 2026 00:49 — with GitHub Actions Active
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.

Bug: Unable to Upload PDF Files to Media Library

2 participants