inconsistent url quoting in x-symlink-target
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Object Storage (swift) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
You can symlink to an object "test space" in your test container using either of these "x-symlink-target" values:
"test/test space"
"test/test%20space"
That's because the symlink middleware makes subrequests without quoting the target_path [1]
The result is that it's difficult and confusing to symlink to an object named "100%farts"
If you create an object named "100% farts" in your test container you symlink with x-symlink-target of "test/100% farts" [2], but if you try the obvious "test/100%farts" you get a 412 [3], because symlinks makes an invalid request - unmodified %fa is a non-utf-8 control character
Instead you have to use x-symlink-target "test/100%25farts"
This strange behavior doesn't really make it impossible to symlink to any object name I've been able to discover, but the optional quoting and the failures on some invalid x-symlink-target values seem incorrect. The testing we have in place to cover this scenario is suspect [4].
1. https:/
2. "test/100%
3. https:/
4.
diff --git a/test/
index 1684f3b05.
--- a/test/
+++ b/test/
@@ -286,6 +286,31 @@ class TestSymlink(Base):
+ wtf = {
+ # this should 200
+ urllib.parse.quote(
+ 'dealde%2Fl04 011e%204c8df/
+ # this should 404
+ urllib.
+ 'dealde%2Fl04 011e%204c8df/
+ # this is maddness
+ 'dealde%2Fl04 011e%204c8df/
+ 'dealde/l04 011e%204c8df/
+ 'dealde%
+ 'dealde%2Fl04 011e%204c8df%
+ 'dealde%
+ }
+ failures = []
+ for name, status in wtf.items():
+ resp = retry(
+ self._make_request, method='GET',
+ container=
+ if resp.status != status:
+ failures.append('%r returned %s, expected %s' % (
+ name, resp.status, status))
+ self.assertFals
+ '\n'.join(
+
# PUT symlink
Change abandoned by Clay Gerrard (<email address hidden>) on branch: master /review. openstack. org/645345 0deb430294da05a 4ec04308040
Review: https:/
Reason: merge Change-Id: I1f300d69bec43f
instead