2012-07-31 01:35:35 |
Ke Wu |
description |
If you upload a file with same name as one subfolder, the file won't be uploaded. However if you create a new subfolder with the same name of one object, the object will be overwritten.
Here subfolder mean the objects with the content-type of "application/directory", I used cloudfiles Python api when found this problem. |
If you upload a file with same name as one subfolder, the file won't be uploaded. However if you create a new subfolder with the same name of one object, the object will be overwritten.
Say I have a container called test, the contents are:
pseudo-1/ (pseudo folder)
file-1 (actual file)
Now I try to upload a actual file to test with the file name "pseudo-1", the file won't be uploaded.
However, if I try to create a new pseudo folder named "file-1", the original actual file would be overwritten by the newly created pseudo folder.
Upload file code:
api = cloudfiles.get_connection(auth=auth)
container = api(request).get_container(container_name)
obj = container.create_object(object_name)
obj.send(object_file)
Create pseudo folder code:
container =swift_api(request).get_container(container_name)
obj =container.create_object(folder_name)
obj.headers = {'content-type':'application/directory','content-length':0}
obj.send('')
obj.sync_metadata() |
|
2012-07-31 01:36:03 |
Ke Wu |
description |
If you upload a file with same name as one subfolder, the file won't be uploaded. However if you create a new subfolder with the same name of one object, the object will be overwritten.
Say I have a container called test, the contents are:
pseudo-1/ (pseudo folder)
file-1 (actual file)
Now I try to upload a actual file to test with the file name "pseudo-1", the file won't be uploaded.
However, if I try to create a new pseudo folder named "file-1", the original actual file would be overwritten by the newly created pseudo folder.
Upload file code:
api = cloudfiles.get_connection(auth=auth)
container = api(request).get_container(container_name)
obj = container.create_object(object_name)
obj.send(object_file)
Create pseudo folder code:
container =swift_api(request).get_container(container_name)
obj =container.create_object(folder_name)
obj.headers = {'content-type':'application/directory','content-length':0}
obj.send('')
obj.sync_metadata() |
If you upload a file with same name as one subfolder, the file won't be uploaded. However if you create a new subfolder with the same name of one object, the object will be overwritten.
Say I have a container called test, the contents are:
pseudo-1/ (pseudo folder)
file-1 (actual file)
Now I try to upload a actual file to test with the file name "pseudo-1", the file won't be uploaded.
However, if I try to create a new pseudo folder named "file-1", the original actual file would be overwritten by the newly created pseudo folder.
Upload file code:
api = cloudfiles.get_connection(auth=auth)
container = api(request).get_container(container_name)
obj = container.create_object(object_name)
obj.send(object_file)
Create pseudo folder code:
container = api(request).get_container(container_name)
obj = container.create_object(folder_name)
obj.headers = {'content-type':'application/directory','content-length':0}
obj.send('')
obj.sync_metadata() |
|