diff --git a/apps/dav/lib/Connector/Sabre/Directory.php b/apps/dav/lib/Connector/Sabre/Directory.php index db02d883a2881..441e6ea8f570c 100644 --- a/apps/dav/lib/Connector/Sabre/Directory.php +++ b/apps/dav/lib/Connector/Sabre/Directory.php @@ -192,56 +192,6 @@ public function createDirectory($name) { } } - /** - * Creates a new symlink - * - * @param string $name - * @param string $target - * @return null|string - * @throws FileLocked - * @throws InvalidPath - * @throws ServiceUnavailable - * @throws \Sabre\DAV\Exception - * @throws \Sabre\DAV\Exception\Forbidden - */ - public function createSymlink($name, $target) { - try { - if (!$this->info->isCreatable()) { - throw new \Sabre\DAV\Exception\Forbidden(); - } - - $this->fileView->verifyPath($this->path, $name); - - [$storage, $internalPath] = $this->fileView->resolvePath($this->path); - if (!$storage || !$storage->instanceOfStorage(\OC\Files\Storage\Local::class)) { - throw new \Sabre\DAV\Exception\NotImplemented("Symlinks currently not supported on non-local storages - failed to create '$name'!"); - } - - $internalPath = $internalPath . '/' . $name; - $storage->unlink($internalPath); - if (!$storage->symlink($target, $internalPath)) { - throw new \Sabre\DAV\Exception\Forbidden("Could not create symlink '$name'!"); - } - $storage->getUpdater()->update($internalPath); - $newEtag = $storage->getETag($internalPath); - $infoData = [ - 'type' => FileInfo::TYPE_FILE, - 'etag' => $newEtag, - ]; - $path = \OC\Files\Filesystem::normalizePath($this->path . '/' . $name); - $this->fileView->putFileInfo($path, $infoData); - return '"' . $newEtag . '"'; - } catch (\OCP\Files\StorageNotAvailableException $e) { - throw new ServiceUnavailable($e->getMessage(), $e->getCode(), $e); - } catch (InvalidPathException $ex) { - throw new InvalidPath($ex->getMessage(), false, $ex); - } catch (ForbiddenException $ex) { - throw new Forbidden($ex->getMessage(), $ex->getRetry(), $ex); - } catch (LockedException $e) { - throw new FileLocked($e->getMessage(), $e->getCode(), $e); - } - } - /** * Returns a specific child node, referenced by its name * diff --git a/lib/private/Files/Storage/Local.php b/lib/private/Files/Storage/Local.php index 660d68adc7a8a..0fca853da5987 100644 --- a/lib/private/Files/Storage/Local.php +++ b/lib/private/Files/Storage/Local.php @@ -181,10 +181,6 @@ public function is_file($path) { return is_file($this->getSourcePath($path)); } - public function is_link($path) { - return is_link($this->getSourcePath($path)); - } - public function stat($path) { $fullPath = $this->getSourcePath($path); clearstatcache(true, $fullPath); @@ -341,21 +337,10 @@ public function file_put_contents($path, $data) { return $result; } - /** - * create symlink - * - * @param string $path - * @param string $target - * @return bool - */ - public function symlink($target, $path) { - return symlink($target, $this->getSourcePath($path)); - } - public function unlink($path) { if ($this->is_dir($path)) { return $this->rmdir($path); - } elseif ($this->is_file($path) || $this->is_link($path)) { + } elseif ($this->is_file($path)) { return unlink($this->getSourcePath($path)); } else { return false;