storage: fix 404 when setting headers or metadata on keys with special characters - #922
Merged
pierre-emmanuelJ merged 4 commits intoOct 2, 2026
Conversation
Headers and metadata are updated with an in-place CopyObject whose copy source was sent unencoded. The server URL-decodes it, so a key holding a percent-encoded sequence such as `%26` pointed at another object and the command reported a 404 although the object exists. The copy source is now built by the helper `copy` and `move` already use. That helper left `+` as is, which the server reads as a space: it is encoded too, which fixes the same 404 on `copy` and `move`. [sc-201630] AI-assisted: true Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
AI-assisted: true Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kobajagi
reviewed
Oct 2, 2026
Comment on lines
+125
to
+127
| // copySource returns the URL-encoded source of a copy operation. The server | ||
| // decodes it the way it decodes a query string, so "+" has to be encoded too | ||
| // or it would be read as a space. |
Contributor
There was a problem hiding this comment.
Would url.QueryEscape do the same thing?
Member
Author
There was a problem hiding this comment.
Yes, and it is simpler: url.QueryEscape encodes + itself, so the manual replace is gone. The one difference is that a space is now sent as + instead of %20, which the server decodes back to a space. Changed, and the e2e scenario (key with &, space, + and %26) passes against SOS.
…etting-headers-on-an-existing-object-reports-a-404 # Conflicts: # CHANGELOG.md
AI-assisted: true Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
kobajagi
approved these changes
Oct 2, 2026
natalie-o-perret
approved these changes
Oct 2, 2026
pierre-emmanuelJ
deleted the
pej/sc-201630/cli-setting-headers-on-an-existing-object-reports-a-404
branch
October 2, 2026 14:23
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
exo storage headers add/metadata addreported a 404 on an object that exists when its key holds a percent-encoded sequence (e.g. a literal%26) or a+. These commands rewrite the object with an in-place copy, and the copy source was sent unencoded, so the server decoded it into another key.+included.storage copy/movealready encoded it but left+as is and hit the same 404 on such keys; they are fixed too.[sc-201630]
Checklist
(For exoscale contributors)
CHANGELOG.md)Testing
Unit tests, a new e2e scenario (
storage_headers_special_chars.txtar), and a manual run against SOS: 404 with the binary built from master, success with this branch.Note
AI assistance: code, tests, PR description.
🤖 Generated with Claude Code