[files] remove normalizePath on rename and dependency injection
This commit is contained in:
parent
324c423548
commit
b9f426b1d7
|
@ -26,7 +26,10 @@ require_once realpath( dirname(__FILE__).'/../lib/files.php' );
|
||||||
OCP\JSON::checkLoggedIn();
|
OCP\JSON::checkLoggedIn();
|
||||||
OCP\JSON::callCheck();
|
OCP\JSON::callCheck();
|
||||||
|
|
||||||
$files = new \OCA\Files\Files();
|
$files = new \OCA\Files\Files(
|
||||||
|
\OC\Files\Filesystem::getView(),
|
||||||
|
\OC_L10n::get('files')
|
||||||
|
);
|
||||||
$result = $files->rename(
|
$result = $files->rename(
|
||||||
$_GET["dir"],
|
$_GET["dir"],
|
||||||
$_GET["file"],
|
$_GET["file"],
|
||||||
|
|
|
@ -27,8 +27,9 @@ namespace OCA\Files;
|
||||||
class Files {
|
class Files {
|
||||||
private $l10n;
|
private $l10n;
|
||||||
|
|
||||||
public function __construct() {
|
public function __construct($view, $l10n) {
|
||||||
$this->l10n = \OC_L10n::get('files');
|
$this->view = $view;
|
||||||
|
$this->l10n = $l10n;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,10 +57,7 @@ class Files {
|
||||||
// rename of "/Shared" is denied
|
// rename of "/Shared" is denied
|
||||||
!($dir === '/' and $oldname === 'Shared') and
|
!($dir === '/' and $oldname === 'Shared') and
|
||||||
// THEN try to rename
|
// THEN try to rename
|
||||||
\OC\Files\Filesystem::rename(
|
$this->view->rename($dir . '/' . $oldname, $dir . '/' . $newname)
|
||||||
\OC\Files\Filesystem::normalizePath($dir . '/' . $oldname),
|
|
||||||
\OC\Files\Filesystem::normalizePath($dir . '/' . $newname)
|
|
||||||
)
|
|
||||||
) {
|
) {
|
||||||
// successful rename
|
// successful rename
|
||||||
$result['success'] = true;
|
$result['success'] = true;
|
||||||
|
|
Loading…
Reference in New Issue