Use the editor to edit save a file
Fixes #184 We should always open try to access the file from the editor point of view. The only moment we can't do this is when we edit from a public page. This makes sure that the paths match properly for versions. Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Родитель
2c68a4d196
Коммит
8f58e022c0
|
@ -220,9 +220,15 @@ class WopiController extends Controller {
|
|||
return new JSONResponse([], Http::STATUS_FORBIDDEN);
|
||||
}
|
||||
|
||||
// Unless the editor is empty (public link) we modify the files as the current editor
|
||||
$editor = $wopi->getEditorUid();
|
||||
if ($editor === null) {
|
||||
$editor = $wopi->getOwnerUid();
|
||||
}
|
||||
|
||||
try {
|
||||
/** @var File $file */
|
||||
$userFolder = $this->rootFolder->getUserFolder($wopi->getOwnerUid());
|
||||
$userFolder = $this->rootFolder->getUserFolder($editor);
|
||||
$file = $userFolder->getById($fileId)[0];
|
||||
|
||||
if ($isPutRelative) {
|
||||
|
@ -275,13 +281,6 @@ class WopiController extends Controller {
|
|||
}
|
||||
|
||||
$content = fopen('php://input', 'rb');
|
||||
// Setup the FS which is needed to emit hooks (versioning).
|
||||
\OC_Util::tearDownFS();
|
||||
if (!$isPutRelative) {
|
||||
\OC_Util::setupFS($wopi->getOwnerUid());
|
||||
} else {
|
||||
\OC_Util::setupFS($wopi->getEditorUid());
|
||||
}
|
||||
|
||||
// Set the user to register the change under his name
|
||||
$editor = $this->userManager->get($wopi->getEditorUid());
|
||||
|
|
Загрузка…
Ссылка в новой задаче