onlook icon indicating copy to clipboard operation
onlook copied to clipboard

fix: render image files correctly in dev tab instead of showing random string

Open Nithishvb opened this issue 4 months ago • 1 comments

Description

This PR fixes an issue where opening an image file in the dev tab displayed a random string instead of rendering the image preview.

Changes

  • Detects image file types and renders them as images in the UI
  • Ensures non-image files continue to display as code

Related Issues

Type of Change

  • [x] Bug fix
  • [ ] New feature
  • [ ] Documentation update
  • [ ] Release
  • [ ] Refactor
  • [ ] Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes


[!IMPORTANT] Fixes image rendering in dev tab by detecting and rendering image files correctly.

  • Behavior:
    • Fixes image rendering in DevTab in index.tsx by detecting image file types and rendering them as images.
    • Non-image files continue to display as code.
  • Functions:
    • Adds getFileUrl() and getMimeType() in index.tsx to handle image rendering.
    • Updates openFile() in index.ts to detect binary files and convert them to base64.
  • Constants:
    • Adds BINARY_EXTENSIONS to files.ts for image file type detection.

This description was created by Ellipsis for c5357d9f4974c6bba950d7667ed2cd813d4eff60. You can customize this summary. It will automatically update as commits are pushed.

Nithishvb avatar Jun 07 '25 13:06 Nithishvb