From b9f426b1d70b1818aab9d54630b8d858a7e5a4dd Mon Sep 17 00:00:00 2001 From: Morris Jobke Date: Tue, 7 May 2013 13:36:29 +0200 Subject: [files] remove normalizePath on rename and dependency injection --- apps/files/ajax/rename.php | 5 ++++- apps/files/lib/files.php | 10 ++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/apps/files/ajax/rename.php b/apps/files/ajax/rename.php index cb7a178852d..f01932a73c3 100644 --- a/apps/files/ajax/rename.php +++ b/apps/files/ajax/rename.php @@ -26,7 +26,10 @@ require_once realpath( dirname(__FILE__).'/../lib/files.php' ); OCP\JSON::checkLoggedIn(); OCP\JSON::callCheck(); -$files = new \OCA\Files\Files(); +$files = new \OCA\Files\Files( + \OC\Files\Filesystem::getView(), + \OC_L10n::get('files') +); $result = $files->rename( $_GET["dir"], $_GET["file"], diff --git a/apps/files/lib/files.php b/apps/files/lib/files.php index 02582eff20a..d5fdc8dde78 100644 --- a/apps/files/lib/files.php +++ b/apps/files/lib/files.php @@ -27,8 +27,9 @@ namespace OCA\Files; class Files { private $l10n; - public function __construct() { - $this->l10n = \OC_L10n::get('files'); + public function __construct($view, $l10n) { + $this->view = $view; + $this->l10n = $l10n; } /** @@ -56,10 +57,7 @@ class Files { // rename of "/Shared" is denied !($dir === '/' and $oldname === 'Shared') and // THEN try to rename - \OC\Files\Filesystem::rename( - \OC\Files\Filesystem::normalizePath($dir . '/' . $oldname), - \OC\Files\Filesystem::normalizePath($dir . '/' . $newname) - ) + $this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname) ) { // successful rename $result['success'] = true; -- cgit v1.2.3