Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2012-01-15 00:13:46 +0400
committerRobin Appelman <icewind@owncloud.com>2012-01-15 00:13:46 +0400
commitf4ce399162b2708fd72ea21be9d1f8dc8da15217 (patch)
tree99382c487dc1bd1b508104ac3234f3aba9e32d53 /lib
parent469a80ac09d3dac7674c0dae9a7bb3d2e6aed0b6 (diff)
fix issue with moving music files
Diffstat (limited to 'lib')
-rw-r--r--lib/files.php19
1 files changed, 17 insertions, 2 deletions
diff --git a/lib/files.php b/lib/files.php
index 88b559059f0..9ae5320ad1d 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -183,8 +183,8 @@ class OC_Files {
*/
public static function move($sourceDir,$source,$targetDir,$target){
if(OC_User::isLoggedIn()){
- $targetFile=$targetDir.'/'.$target;
- $sourceFile=$sourceDir.'/'.$source;
+ $targetFile=self::normalizePath($targetDir.'/'.$target);
+ $sourceFile=self::normalizePath($sourceDir.'/'.$source);
return OC_Filesystem::rename($sourceFile,$targetFile);
}
}
@@ -305,4 +305,19 @@ class OC_Files {
$content.= "Options -Indexes\n";
@file_put_contents(OC::$SERVERROOT.'/.htaccess', $content); //supress errors in case we don't have permissions for it
}
+
+ /**
+ * normalize a path, removing any double, add leading /, etc
+ * @param string $path
+ * @return string
+ */
+ static public function normalizePath($path){
+ $path='/'.$path;
+ $old='';
+ while($old!=$path){//replace any multiplicity of slashes with a single one
+ $old=$path;
+ $path=str_replace('//','/',$path);
+ }
+ return $path;
+ }
}