Skip to content

fix(python): decode file URIs in OpenCLIP - #4131

Open
yhz5613813 wants to merge 1 commit into
lancedb:mainfrom
yhz5613813:fix/openclip-file-uri-decoding
Open

fix(python): decode file URIs in OpenCLIP#4131
yhz5613813 wants to merge 1 commit into
lancedb:mainfrom
yhz5613813:fix/openclip-file-uri-decoding

Conversation

@yhz5613813

@yhz5613813 yhz5613813 commented Sep 5, 2026

Copy link
Copy Markdown

What

Decode the path component of file:// image URIs before passing it to Pillow.

Why

Path.as_uri() percent-encodes characters such as spaces. Passing parsed.path directly to Pillow therefore tries to open a literal %20 path and fails.

Testing

  • Added a regression test that opens an image whose local filename contains a space.
  • Verified the focused URI conversion behavior against the changed method.
  • Ruff check, formatting check, and compileall on both changed files.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@github-actions github-actions Bot added bug Something isn't working Python Python SDK labels Sep 5, 2026
@yhz5613813
yhz5613813 force-pushed the fix/openclip-file-uri-decoding branch from ca764b2 to cf94494 Compare September 5, 2026 07:49

@lancedb-gatekeeper lancedb-gatekeeper Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gate recommendation: approve.

This fixes the failure at the URI-to-native-path boundary: file: URI paths are converted with the standard-library native-path helper before Pillow receives them, while plain paths and HTTP URLs retain their existing behavior. The regression test covers the encoded local-filename case.

@lancedb-gatekeeper lancedb-gatekeeper Bot added the K-approved Latest Gatekeeper recommendation permits acceptance. label Sep 5, 2026
@wjones127
wjones127 self-requested a review September 8, 2026 20:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working K-approved Latest Gatekeeper recommendation permits acceptance. Python Python SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants