aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xinc/HTTP/WebDAV/Server/Filesystem.php8
-rw-r--r--inc/lib_filestorage.php20
-rwxr-xr-xinc/lib_filesystem.php7
3 files changed, 28 insertions, 7 deletions
diff --git a/inc/HTTP/WebDAV/Server/Filesystem.php b/inc/HTTP/WebDAV/Server/Filesystem.php
index e11e3b3f5c9..66d040ba0e2 100755
--- a/inc/HTTP/WebDAV/Server/Filesystem.php
+++ b/inc/HTTP/WebDAV/Server/Filesystem.php
@@ -31,6 +31,7 @@
| ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| POSSIBILITY OF SUCH DAMAGE. |
+----------------------------------------------------------------------+
+ --- modified for ownCloud ---
*/
require_once("../inc/lib_base.php");
oc_require_once("HTTP/WebDAV/Server.php");
@@ -539,6 +540,8 @@
$stat = $this->DELETE(array("path" => $options["dest"]));
if (($stat{0} != "2") && (substr($stat, 0, 3) != "404")) {
return $stat;
+ }else{
+ $new=true;
}
} else {
return "412 precondition failed";
@@ -547,7 +550,7 @@
if ($del) {
if (!OC_FILESYSTEM::rename($source, $dest)) {
- return "500 Internal server error";
+ return "500 Internal server error 1";
}
$destpath = $this->_unslashify($options["dest"]);
if (is_dir($source)) {
@@ -578,7 +581,6 @@
if (OC_FILESYSTEM::is_dir($file)) {
$file = $this->_slashify($file);
}
-
$destfile = str_replace($source, $dest, $file);
if (OC_FILESYSTEM::is_dir($file)) {
@@ -593,9 +595,7 @@
return "409 Conflict";
}
} else {
-
if (!OC_FILESYSTEM::copy($file, $destfile)) {
- error_log("copy $file to $destfile failed");
return "409 Conflict";
}
}
diff --git a/inc/lib_filestorage.php b/inc/lib_filestorage.php
index 3c34cc21102..8448eddd74a 100644
--- a/inc/lib_filestorage.php
+++ b/inc/lib_filestorage.php
@@ -104,7 +104,7 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
return $return;
}
public function is_dir($path){
- return is_dir($this->datadir.$path);
+ return (is_dir($this->datadir.$path) or substr($path,-1)=='/');
}
public function is_file($path){
return is_file($this->datadir.$path);
@@ -166,7 +166,19 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
return $return;
}
public function copy($path1,$path2){
+ if($this->is_dir($path2)){
+ if(!$this->file_exists($path2)){
+ $this->mkdir($path2);
+ }
+ $source=substr($path1,strrpos($path1,'/')+1);
+ $path2.=$source;
+// sleep(30);
+ }else{
+ error_log('isfile');
+ }
+ error_log("copy $path1 to {$this->datadir}$path2");
if($return=copy($this->datadir.$path1,$this->datadir.$path2)){
+ error_log('success');
$this->notifyObservers($path2,OC_FILEACTION_CREATE);
}
return $return;
@@ -346,7 +358,11 @@ class OC_FILESTORAGE_LOCAL extends OC_FILESTORAGE{
}
public function find($path){
- return System::find($this->datadir.$path);
+ $return=System::find($this->datadir.$path);
+ foreach($return as &$file){
+ $file=str_replace($file,$this->datadir,'');
+ }
+ return $return;
}
}
?> \ No newline at end of file
diff --git a/inc/lib_filesystem.php b/inc/lib_filesystem.php
index 934da6b0e3e..1e50ab34ae9 100755
--- a/inc/lib_filesystem.php
+++ b/inc/lib_filesystem.php
@@ -258,8 +258,13 @@ class OC_FILESYSTEM{
}
static public function find($path){
if($storage=self::getStorage($path)){
- return $storage->find(substr($path,strlen(self::getMountPoint($path))));
+ $mp=self::getMountPoint($path);
+ $return=$storage->find(substr($path,strlen($mp)));
+ foreach($return as &$file){
+ $file=$mp.$file;
+ }
}
+ return $return;
}
}
?>