Skip to content

Commit

Permalink
Merge pull request #4 from thepeg/master
Browse files Browse the repository at this point in the history
Fix file download API
  • Loading branch information
shama committed Dec 13, 2012
2 parents a4b1f55 + 4f60ad1 commit 119d619
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Model/Datasource/DropboxSource.php
Expand Up @@ -175,8 +175,15 @@ public function read($Model, $data = array()) {
}
$res = json_decode($json, true);
if (is_null($res) && !empty($json)) {
throw new Exception(__d('dropbox', 'Error decoding json, run json_last_error() after to see the error code.'));
return array();
// file download - output file content
if (gettype($json) == 'object' && isset($json['body'])) {
return $json->body;

// json exception
} else {
throw new Exception(__d('dropbox', 'Error decoding json, run json_last_error() after to see the error code.'));
return array();
}
}
if ($res === false) {
return array();
Expand Down

0 comments on commit 119d619

Please sign in to comment.