Skip to content

Commit

Permalink
Merge pull request #7555 from nextcloud/smb-copy-rename-log
Browse files Browse the repository at this point in the history
additional debug logging on smb copy/rename failures
  • Loading branch information
icewind1991 authored Dec 18, 2017
2 parents 3da92a9 + 4f0d03e commit bdf4111
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
2 changes: 2 additions & 0 deletions apps/files_external/lib/Lib/Storage/SMB.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
use OCP\Files\Notify\IRenameChange;
use OCP\Files\Storage\INotifyStorage;
use OCP\Files\StorageNotAvailableException;
use OCP\Util;

class SMB extends Common implements INotifyStorage {
/**
Expand Down Expand Up @@ -199,6 +200,7 @@ public function rename($source, $target) {
$this->remove($target);
$result = $this->share->rename($absoluteSource, $absoluteTarget);
} catch (\Exception $e) {
\OC::$server->getLogger()->logException($e, ['level' => Util::WARN]);
return false;
}
unset($this->statCache[$absoluteSource], $this->statCache[$absoluteTarget]);
Expand Down
3 changes: 3 additions & 0 deletions lib/private/Files/Storage/Common.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ public function copy($path1, $path2) {
$source = $this->fopen($path1, 'r');
$target = $this->fopen($path2, 'w');
list(, $result) = \OC_Helper::streamCopy($source, $target);
if (!$result) {
\OC::$server->getLogger()->warning("Failed to write data while copying $path1 to $path2");
}
$this->removeCachedFile($path2);
return $result;
}
Expand Down

0 comments on commit bdf4111

Please sign in to comment.