Skip to content

Conversation

@konard
Copy link
Collaborator

@konard konard commented Nov 13, 2025

Summary

This PR implements support for extracting images from public Google Drive links, as requested in issue #13. The implementation now correctly handles both /view and non-/view URL formats, converting them to direct download links.

Changes Made

  1. Core Functionality (src/lib.js):

    • Added convertGoogleDriveUrl() function to detect and convert Google Drive URLs to direct download format
    • Supports multiple URL patterns:
      • https://drive.google.com/file/d/{FILE_ID}/view
      • https://drive.google.com/file/d/{FILE_ID}
      • https://drive.google.com/open?id={FILE_ID}
  2. Image Endpoint (src/image.js):

    • Detects Google Drive URLs and directly downloads the image file instead of taking a screenshot
    • Returns the actual image with correct content type
  3. HTML Endpoint (src/html.js):

    • For Google Drive images, generates a simple HTML page displaying the image
    • Includes proper styling for image display
  4. Markdown Endpoint (src/markdown.js):

    • Fetches content from converted Google Drive URLs
    • Converts the response to markdown format

Testing

  • Unit Tests (tests/unit/convertGoogleDriveUrl.test.js):

    • 11 comprehensive tests covering URL conversion logic
    • Tests for edge cases (null, undefined, empty strings)
    • Tests for various URL formats
  • E2E Tests (tests/e2e/google-drive.test.js):

    • 12 end-to-end tests covering all three endpoints
    • Tests both example URLs from the issue
    • Tests both /view and non-/view formats

Test Results

All tests passing locally:

Test Suites: 7 passed, 7 total (excluding docker tests)
Tests:       71 passed, 71 total

Specifically for Google Drive:

  • ✅ Unit tests: 11/11 passing
  • ✅ E2E tests: 12/12 passing (4 per endpoint × 3 endpoints)

Verified Functionality

Tested with the exact URLs from issue #13:

  • https://drive.google.com/file/d/1Cxkx6-428EQAX0-eiaq66H829ohnPp7q/view
  • https://drive.google.com/file/d/1Cxkx6-428EQAX0-eiaq66H829ohnPp7q (without /view)
  • https://drive.google.com/file/d/1fgJaftjv53xCN7vgiJOaQlbfWkUqPgyd/view
  • https://drive.google.com/file/d/1fgJaftjv53xCN7vgiJOaQlbfWkUqPgyd (without /view)

All endpoints (/image, /html, /markdown) correctly extract content from these URLs.

Closes #13

🤖 Generated with Claude Code

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #13
@konard konard self-assigned this Nov 13, 2025
- Add convertGoogleDriveUrl() function to detect and convert Google Drive URLs to direct download links
- Support both /view and non-/view URL formats
- Update image handler to directly download images from Google Drive instead of taking screenshots
- Update HTML handler to generate simple HTML page for Google Drive images
- Update markdown handler to fetch content from converted Google Drive URLs
- Add comprehensive E2E tests for all three endpoints (/image, /html, /markdown) with Google Drive URLs
- Add unit tests for URL conversion function with edge cases

Fixes #13

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

Co-Authored-By: Claude <noreply@anthropic.com>
@konard konard changed the title [WIP] Add two tests, that we can extract images from public Google Drive links feat: Add Google Drive image extraction support Nov 13, 2025
@konard konard marked this pull request as ready for review November 13, 2025 03:34
@konard
Copy link
Collaborator Author

konard commented Nov 13, 2025

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.754589 USD
  • Calculated by Anthropic: $1.613716 USD
  • Difference: $-2.140873 (-57.02%)
    📎 Log file uploaded as GitHub Gist (595KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

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.

Add two tests, that we can extract images from public Google Drive links

2 participants