Commit Graph

7 Commits

Author SHA1 Message Date
Giancarmine Salucci
5fe0a8a96e fix(tandoor): convert Buffer to Uint8Array for Blob compatibility
TypeScript compiler error fixed: Buffer is not assignable to BlobPart.
Convert Buffer to Uint8Array before creating Blob.
2025-12-21 05:19:45 +01:00
Giancarmine Salucci
cc7b8032cb fix(tandoor): use File constructor for proper multipart uploads
- Remove unreliable URL pass-through strategy (image_url field)
- Always download and upload images as File objects
- Get MIME type from HTTP response headers for URLs
- Use File constructor (not just Blob) for proper multipart metadata
- Add comprehensive error logging with headers and file metadata
- Simplify to single reliable upload path

Fixes 400 'Upload a valid image' error caused by Blob not providing
proper filename/MIME metadata in multipart form data.
2025-12-21 05:19:33 +01:00
Giancarmine Salucci
856c5c26f4 revert(tandoor): change auth header back to Bearer
User's Tandoor instance uses Bearer token authentication (likely JWT)
rather than Django REST Framework's Token authentication.

Reverts authentication from 'Token' back to 'Bearer' to fix 403 error:
'Authentication credentials were not provided.'
2025-12-21 05:08:41 +01:00
Giancarmine Salucci
d1dc791854 fix(tandoor): implement smart image upload with auth fix
- Fix authentication header from 'Bearer' to 'Token' (DRF TokenAuth)
- Implement three-strategy upload system:
  1. URL pass-through for direct URLs (most efficient)
  2. Base64 data URL conversion for screenshots
  3. Fallback blob upload for any other format
- Add comprehensive error handling with response details
- Add detailed logging for debugging upload strategies
- Document thumbnail formats in extractThumbnailStealth()

Fixes #30 - Tandoor image upload 400 Bad Request error

Based on Tandoor source code analysis (cookbook/views/api.py):
- RecipeImageSerializer accepts 'image_url' field for server-side download
- Uses Token authentication, not Bearer
- Supports multipart file upload with proper MIME types
2025-12-21 04:58:45 +01:00
Giancarmine Salucci
9357bd483a fix 2025-12-21 02:03:05 +01:00
Giancarmine Salucci
167cd1f4bb with thumbnail! 2025-11-30 21:56:21 +01:00
Giancarmine Salucci
23583f54c6 full tour 2025-11-30 09:06:44 +01:00