cakebox icon indicating copy to clipboard operation
cakebox copied to clipboard

The plugin out of the box appears broken for CakePHP 2.4.x

Open DevinStetler opened this issue 10 years ago • 0 comments

The reason may be a change in the way Dropbox API receives "fileops" and "account" requests. I can only guess but DropboxSource.php was sending 'path' and 'root' incorrectly depending on the call type.

I hacked it fast so I don't claim to have written the cleanest solution, but it is working now.

The "build endpoint" section is replaced at line 146 with...

// Build endpoint and conditions
        $call = explode('/', $api);
        // pass 'root' param *only* for 'fileops' calls
        if ($call[0] == "fileops" || $call[0] == "account") {
            $endpoint = $api;

            // pass 'path' param only for 'create_folder' and 'delete'
            if ($call[1] != "create_folder" && $call[1] != "delete") {
                unset($data['conditions']['path']);
            }
            if ($call[0] == "account") {
                unset($data['conditions']['root']);
            }
        }
        else {
            $endpoint = $api . '/' . $data['conditions']['root'] . '/' . $data['conditions']['path'];

            unset($data['conditions']['root']);
            unset($data['conditions']['path']);
        }

Otherwise very solid plugin. Thank you!

DevinStetler avatar Mar 12 '15 01:03 DevinStetler