Browse Source

[files] remove normalizePath on rename and dependency injection

tags/v6.0.0alpha2
Morris Jobke 11 years ago
parent
commit
b9f426b1d7
2 changed files with 8 additions and 7 deletions
  1. 4
    1
      apps/files/ajax/rename.php
  2. 4
    6
      apps/files/lib/files.php

+ 4
- 1
apps/files/ajax/rename.php View File

@@ -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"],

+ 4
- 6
apps/files/lib/files.php View File

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

Loading…
Cancel
Save