Commit graph

1 commit

Author SHA1 Message Date
ggq-admin
19d90f50ca Add image retrieval API endpoints
Implemented three new REST endpoints for serving extracted images from documents:
- GET /api/documents/:id/images - Returns all images for a document
- GET /api/documents/:id/pages/:pageNum/images - Returns images for specific page
- GET /api/images/:imageId - Streams image file (PNG/JPEG) with proper headers

Features:
- Full access control verification using existing auth patterns
- Secure file serving with path traversal protection
- Proper Content-Type and caching headers
- Rate limiting for image endpoints
- Comprehensive error handling for invalid IDs and missing files
- JSON responses with image metadata including OCR text and positioning

Testing:
- Created comprehensive test suite (test-image-endpoints.sh)
- All endpoints tested with curl and verified working
- Error cases properly handled (404, 403, 400)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-19 19:57:49 +02:00