浏览代码

Merge pull request #12090 from AdamWill/google-rename-delete

google: delete original after successful rename
tags/v8.0.0alpha1
Morris Jobke 9 年前
父节点
当前提交
e3de51078d
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12
    0
      apps/files_external/lib/google.php

+ 12
- 0
apps/files_external/lib/google.php 查看文件

@@ -370,10 +370,22 @@ class Google extends \OC\Files\Storage\Common {
return false;
}
}
// We need to get the object for the existing file with the same
// name (if there is one) before we do the patch. If oldfile
// exists and is a directory we have to delete it before we
// do the rename too.
$oldfile = $this->getDriveFile($path2);
if ($oldfile && $this->is_dir($path2)) {
$this->rmdir($path2);
$oldfile = false;
}
$result = $this->service->files->patch($file->getId(), $file);
if ($result) {
$this->setDriveFile($path1, false);
$this->setDriveFile($path2, $result);
if ($oldfile) {
$this->service->files->delete($oldfile->getId());
}
}
return (bool)$result;
} else {

正在加载...
取消
保存