small webdav fixes

remotes/origin/stable
Robin 14 years ago
parent 086f060b9e
commit d909f91d07

@ -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";
}
}

@ -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;
}
}
?>

@ -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;
}
}
?>

Loading…
Cancel
Save