diff --git a/lib/db/session.php b/lib/db/session.php index d6d79385..df945090 100644 --- a/lib/db/session.php +++ b/lib/db/session.php @@ -38,9 +38,12 @@ class Db_Session extends \OCA\Documents\Db { public static function start($uid, File $file){ list($ownerView, $path) = $file->getOwnerViewAndPath(); + // Create a directory to store genesis + $docView = $ownerView->initDocumentsView(); + $oldSession = new Db_Session(); $oldSession->loadBy('file_id', $file->getFileId()); - + //If there is no existing session we need to start a new one if (!$oldSession->hasData()){ diff --git a/lib/view.php b/lib/view.php index e56af7f0..898e44e3 100644 --- a/lib/view.php +++ b/lib/view.php @@ -49,6 +49,10 @@ class View extends \OC\Files\View{ $newName = '/' . sha1($ownerView->file_get_contents($filePath)) . '.odt'; $ownerView->copy($filePath, self::DOCUMENTS_DIRNAME . $newName); + if (!$ownerView->file_exists(self::DOCUMENTS_DIRNAME . $newName)){ + throw new \Exception('Failed to copy genesis'); + } + \OC_FileProxy::$enabled = $proxyStatus; return $newName; }