Skip to content
This repository has been archived by the owner on Jan 29, 2021. It is now read-only.

Rackspace Cloudfiles are not deleted or cleaned up #194

Open
challgren opened this issue Sep 15, 2017 · 0 comments
Open

Rackspace Cloudfiles are not deleted or cleaned up #194

challgren opened this issue Sep 15, 2017 · 0 comments

Comments

@challgren
Copy link

Rackspace Cloudfiles aren't deleted because the name of the object sent to Cloudfiles is the full URL which isn't a valid name since the format expected is {folder}/{name} or {name}. I know this project is no longer maintaned but for other people having the same issue the solution is to edit AttachmentBehavior.php around line 747 and change the following code

$transporter = $this->_getTransporter($attachment, $attachment['transport']);

return $transporter->delete($path);

to

$transporter = $this->_getTransporter($attachment, $attachment['transport']);
if ($attachment['transport']['class'] == 'cloudfiles') {
    $url = parse_url($path);
    $path = ltrim($url['path'], '/');
}
return $transporter->delete($path);

I was going to make the code folder specific but this code allows images to be deleted in moved the container to different folders. For example you first put the image in the folder Items and then decide to change the folder to products. Old records that point to items will still be deleted.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant