diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-06-17 17:27:35 +0300 |
---|---|---|
committer | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2016-06-17 17:27:35 +0300 |
commit | 0c508a09e0fbe37f9d182e15206048b0c822af71 (patch) | |
tree | cc58d6272f69b46f2aec6e9110fbb298317aa6d3 /lib | |
parent | a5c833a7a20eb9420b5154dcc5a4e738f6dd2e57 (diff) |
Support for file versioning in WOPI
Diffstat (limited to 'lib')
-rw-r--r-- | lib/db/wopi.php | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/db/wopi.php b/lib/db/wopi.php index 12a0aaef..cc722774 100644 --- a/lib/db/wopi.php +++ b/lib/db/wopi.php @@ -45,14 +45,16 @@ class Wopi extends \OCA\Richdocuments\Db{ $view = \OC\Files\Filesystem::getView(); // Get the virtual path (if the file is shared). $path = $view->getPath($fileId); + if (!$view->is_file($path) || !$view->isUpdatable($path)) { throw new \Exception('Invalid fileId.'); } // Figure out the real owner, if not us. $user = $view->getOwner($path); - // Create a view into the owner's FS. - $view = new \OC\Files\View('/' . $user . '/'); + + // Create a view into the owner's FS. + $view = new \OC\Files\View('/' . $user . '/files'); // Find the real path. $path = $view->getPath($fileId); if (!$view->is_file($path)) { @@ -63,8 +65,8 @@ class Wopi extends \OCA\Richdocuments\Db{ \OCP\Security\ISecureRandom::CHAR_LOWER . \OCP\Security\ISecureRandom::CHAR_UPPER . \OCP\Security\ISecureRandom::CHAR_DIGITS); - \OC::$server->getLogger()->debug('Issuing token for {user} file {fileId}: {token}', - [ 'user' => $user, 'fileId' => $fileId, 'token' => $token ]); + \OC::$server->getLogger()->debug('Issuing token for {user} file {fileId}, path {path}: {token}', + [ 'user' => $user, 'fileId' => $fileId, 'path' => $path, 'token' => $token ]); $wopi = new \OCA\Richdocuments\Db\Wopi([ $user, @@ -112,7 +114,7 @@ class Wopi extends \OCA\Richdocuments\Db{ } $user = $row['uid']; - $view = new \OC\Files\View('/' . $user . '/'); + $view = new \OC\Files\View('/' . $user . '/files'); $path = $row['path']; if (!$view->is_file($path)) { |