Skip to content

ObjectStorage Copy bug #3

@svenkaptein

Description

@svenkaptein

There is a bug in the ObjectStorage Copy functionality (as far I can determine).
I am using it against the RACKSPACE api for cloudfiles openstack.

The target URI which is retrieved from the $target Dataobject is containing the full URI.
The DESTINATION header URI should only contain the container + name of the object. Now its something like:

/v1/MossoCloudFS_83ed7af5-38b3-444a-b945-2bb0b124f076

So my fix is now replacing this URI with a regex. Then the copy function works. Otherwise it will give a 404 response (which is logical).

Function with the problem in dataobject.inc

/**
* Copies the object to another container/object
*
* Note that this function, because it operates within the Object Store itself,
* is much faster than downloading the object and re-uploading it to a new object.
*
* @param DataObject $target the target of the COPY command
*/
public function Copy(Dataobject $target) {
$info = parse_url($target->Url());
$uri = $info['path'];
$response = $this->Service()->Request(
$this->Url(),
'COPY',
array('Destination' => $uri ));

    // check response code
    if ($response->HttpStatus() > 202)
        throw new ObjectCopyError(sprintf(
            _('Error copying object [%s], status [%d] response [%s]'),
            $this->Url(), $response->HttpStatus(), $response->HttpBody()));

    return $response;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions