Uploading a file from parent dir with relative path results in two containers created and no file upload

Bug #1541018 reported by James Nzomo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-swiftclient
In Progress
Undecided
James Nzomo

Bug Description

Calling `swift upload container_name ../file_name` will create containers "container_name" and "file_name" (idempotently) instead of uploading "file_name" into "container_name"

James Nzomo (moje)
Changed in python-swiftclient:
assignee: nobody → James Nzomo (moje)
James Nzomo (moje)
Changed in python-swiftclient:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to python-swiftclient (master)

Fix proposed to branch: master
Review: https://review.openstack.org/280312

Revision history for this message
Tim Burke (1-tim-z) wrote :

Note that it can also manifest as upload failures:

vagrant@saio:~/swift$ swift list
vagrant@saio:~/swift$ swift upload test ../swift/tox.ini
Object PUT failed: https://saio/v1/AUTH_test/swift/tox.ini 404 Not Found [first 60 chars of response] b'<html><h1>Not Found</h1><p>The resource could not be found.<' (txn: tx28319613602045248215a-0065bbea04)
vagrant@saio:~/swift$ swift list
test
vagrant@saio:~/swift$ swift list test
vagrant@saio:~/swift$

From looking at the debug output, it seems to be an issue of some path normalization happening between swiftclient and urllib3:

DEBUG:urllib3.connectionpool:https://saio:443 "PUT /v1/AUTH_test/swift/tox.ini HTTP/1.1" 404 70
INFO:swiftclient:REQ: curl -i https://saio/v1/AUTH_test/test/../swift/tox.ini -X PUT -H "x-object-meta-mtime: 1706655423.853881" -H "X-Auth-Token: AUTH_tk4731a83675b948d8a12fe4b183cef571" -H "Content-Length: 5846"

Also note that you can't avoid the normalization by using --object-name:

vagrant@saio:~/swift$ swift upload test tox.ini --object-name 'bad/./././name'
bad/./././name
vagrant@saio:~/swift$ swift list test
bad/name

And trying to escape the name results in using the escaped name:

vagrant@saio:~/swift$ swift upload test tox.ini --object-name 'bad/%2E/%2E/%2E/name'
bad/%2E/%2E/%2E/name
vagrant@saio:~/swift$ swift list test
bad/%2E/%2E/%2E/name
bad/name

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.