swift tool upload does't strip initial "/" of an object when object

Bug #817766 reported by Marcelo Martins
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Object Storage (swift)
Fix Released
Undecided
Marcelo Martins

Bug Description

Example:

swift -A https://XXXXX/auth/v1.0 -U "swiftops:swiftops" -K swiftops upload backup3 /etc/vim/vimrc.tiny
/etc/vim/vimrc.tiny

So a ReST request on the object above would require double "/" as shown below:
curl -ik -H "$XT" -X GET $XU/backup3//etc/vim/vimrc.tiny

curl -Ik -H "$XT" -X HEAD $XU/backup3//etc/vim/vimrc.tiny
HTTP/1.1 200 OK
Last-Modified: Thu, 28 Jul 2011 21:02:56 GMT
Etag: 3b4112567ad92c78ccc16c670df381e9
X-Object-Meta-Mtime: 1271424831.0
Accept-Ranges: bytes
Content-Length: 662
Content-Type: application/octet-stream
X-Trans-Id: tx127ae006b1e04a13b0b96829c0ffa765
Date: Thu, 28 Jul 2011 21:39:34 GMT

curl -Ik -H "$XT" -X HEAD $XU/backup3/etc/vim/vimrc.tiny
HTTP/1.1 404 Not Found
Content-Length: 0
Content-Type: text/html; charset=UTF-8
X-Trans-Id: tx9d1b4bbde4bc4038b6154ad655bdc149
Date: Thu, 28 Jul 2011 21:39:38 GMT

Related branches

Revision history for this message
Marcelo Martins (btorch) wrote :

=== modified file 'bin/swift'
--- bin/swift 2011-07-07 14:24:37 +0000
+++ bin/swift 2011-07-28 22:29:36 +0000
@@ -1607,6 +1607,8 @@
             obj = path
             if obj.startswith('./') or obj.startswith('.\\'):
                 obj = obj[2:]
+ if obj.startswith('/'):
+ obj = obj[1:]
             put_headers = {'x-object-meta-mtime': str(getmtime(path))}
             if dir_marker:
                 if options.changed:

Marcelo Martins (btorch)
Changed in swift:
assignee: nobody → Marcelo Martins (btorch)
status: New → Fix Committed
Thierry Carrez (ttx)
Changed in swift:
milestone: none → 1.4.3
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.