Skip to content

Encode spaces as %20 in listings, not '+' - #30

Open
krokicki wants to merge 1 commit into
mainfrom
fix-space-encoding
Open

Encode spaces as %20 in listings, not '+'#30
krokicki wants to merge 1 commit into
mainfrom
fix-space-encoding

Conversation

@krokicki

Copy link
Copy Markdown
Member

encoding-type=url means percent-encoding, but url_encode() replaced spaces with +, so a file named my file.txt was listed as key my+file.txt. Clients undo the encoding by unquoting (boto3) or with decodeURIComponent (Neuroglancer), and neither turns + back into a space — so a key read out of a listing pointed at a file that doesn't exist, and fetching it 404'd.

Any file or directory whose name contains a space was affected, which is why it turned up immediately on real data: browsing a Fileglancer data link in Neuroglancer showed the entries but couldn't open them.

quote(s, safe='/') now handles it, which also encodes a literal + as %2B and so tells the two apart. / is still left alone so keys keep their structure.

New test builds a target over a tree with spaced names, asserts the listing reports my%20file.txt and sub%20dir/, and then reads the key back through the app to prove it resolves. Full suite passes (81).

🤖 Generated with Claude Code

EncodingType=url means percent-encoding, but url_encode() replaced spaces
with '+', so a file named "my file.txt" was listed as key "my+file.txt".
Clients undo the encoding by unquoting (boto3) or with decodeURIComponent
(Neuroglancer), and neither turns '+' back into a space, so a key taken
from a listing named a file that does not exist and fetching it 404'd.

Any name containing a space was affected: browsing a Fileglancer data
link in Neuroglancer listed the entries but could not open them.

quote(s, safe='/') also encodes a literal '+' as %2B, which tells the two
apart. Added a listing test over a tree with spaced names that reads a
reported key back through the app.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.

1 participant