Skip to content

fix(storage): stop truncating object paths at '?' and '#' - #1641

Open
rmnvg wants to merge 1 commit into
supabase:mainfrom
rmnvg:fix/storage-path-query-chars
Open

rmnvg wants to merge 1 commit into
supabase:mainfrom
rmnvg:fix/storage-path-query-chars

Conversation

@rmnvg

@rmnvg rmnvg commented Sep 15, 2026

Copy link
Copy Markdown

What

relative_path_to_parts now escapes ? and # before handing the path to yarl.URL. They stay part of the path, and yarl encodes them as %3F / %23 when it builds the request URL.

Before: upload("folder/what?.png").../object/bucket/folder/what
After: upload("folder/what?.png").../object/bucket/folder/what%3F.png

Why this approach

The change is kept to the smallest possible scope. All other parsing behavior is unchanged: leading / is stripped, and already-percent-encoded input like a%20b.png is still decoded the same way. A test covers that case.

Tests

  • Unit tests for relative_path_to_parts (async and sync)
  • upload (async and sync) and get_public_url assert the final request URL
  • The new tests fail on main and pass with the fix; ruff and mypy are clean

Closes #1640

cc @olirice @silentworks for review

🤖 Generated with Claude Code

relative_path_to_parts parsed the object path as a URL, so a '?' or '#'
started a query string or fragment and everything after it was dropped.
upload('folder/what?.png') silently wrote to the key 'folder/what'.
'?' is a valid object key character in Supabase Storage.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@rmnvg
rmnvg requested review from a team and o-santi as code owners September 15, 2026 13:17
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.

storage3: object paths containing ? are silently truncated

1 participant