Skip to content
Browse files

Merge branch 's8_MDL-26798_dropbox_repo' of git://github.com/dongshen…

…g/moodle
  • Loading branch information...
2 parents bc071c7 + ab603b2 commit e1339a6dda3f39f11854623d262b6ffb4e7d2ca3 Sam Hemelryk committed Mar 28, 2011
Showing with 5 additions and 8 deletions.
  1. +3 −7 repository/dropbox/lib.php
  2. +2 −1 repository/dropbox/locallib.php
View
10 repository/dropbox/lib.php
@@ -19,11 +19,6 @@
* repository_dropbox class
* This plugin is used to access user's dropbox files
*
- * TODO:
- * Dropbox has problems to process filepath with spaces, tried to use
- * urlencode filepath, still doesn't work
- * http://code.google.com/p/dropbox-php/ has the same problem
- *
* @since 2.0
* @package repository
* @subpackage dropbox
@@ -130,18 +125,19 @@ public function get_listing($path = '', $page = '1') {
} else {
$path = file_correct_filepath($path);
}
+ $encoded_path = str_replace("%2F", "/", rawurlencode($path));
$list = array();
$list['list'] = array();
$list['manage'] = false;
$list['dynload'] = true;
$list['nosearch'] = true;
- // process breacrumb trail
+ // process breadcrumb trail
$list['path'] = array(
array('name'=>get_string('dropbox', 'repository_dropbox'), 'path'=>'/')
);
- $result = $this->dropbox->get_listing($path, $this->access_key, $this->access_secret);
+ $result = $this->dropbox->get_listing($encoded_path, $this->access_key, $this->access_secret);
if (!is_object($result) || empty($result)) {
return $list;
View
3 repository/dropbox/locallib.php
@@ -70,7 +70,8 @@ public function get_file($filepath, $saveas) {
$basename = $info['basename'];
$filepath = $dirname . rawurlencode($basename);
if ($dirname != '/') {
- $filepath = $dirname . '/' . rawurlencode($basename);
+ $filepath = $dirname . '/' . $basename;
+ $filepath = str_replace("%2F", "/", rawurlencode($filepath));
}
$url = $this->dropbox_content_api.'/files/'.$this->mode.$filepath;

0 comments on commit e1339a6

Please sign in to comment.
Something went wrong with that request. Please try again.