Skip to content

Commit

Permalink
disabling forcesave for federated file
Browse files Browse the repository at this point in the history
  • Loading branch information
LinneyS committed Sep 28, 2020
1 parent f851b84 commit 10ddeb3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
use OCP\Share\Exceptions\ShareNotFound;
use OCP\Share\IManager;

use OCA\Files_Sharing\External\Storage as SharingExternalStorage;

use OCA\Onlyoffice\AppConfig;
use OCA\Onlyoffice\Crypt;
use OCA\Onlyoffice\KeyManager;
Expand Down Expand Up @@ -504,6 +506,13 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan
$prevIsForcesave = KeyManager::wasForcesave($fileId);

$isForcesave = $status === self::TrackerStatus_ForceSave || $status === self::TrackerStatus_CorruptedForceSave;

if ($isForcesave
&& $file->getStorage()->instanceOfStorage(SharingExternalStorage::class)) {
$this->logger->info("Track: $fileId status $status not allowed for external file", ["app" => $this->appName]);
break;
}

//lock the key when forcesave and unlock if last forcesave is broken
KeyManager::lock($fileId, $isForcesave);

Expand Down

0 comments on commit 10ddeb3

Please sign in to comment.