summaryrefslogtreecommitdiffstats
path: root/apps/files_versions
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files_versions')
-rw-r--r--apps/files_versions/lib/storage.php14
-rw-r--r--apps/files_versions/tests/versions.php7
2 files changed, 17 insertions, 4 deletions
diff --git a/apps/files_versions/lib/storage.php b/apps/files_versions/lib/storage.php
index dd8af1b8d18..6737bf20f90 100644
--- a/apps/files_versions/lib/storage.php
+++ b/apps/files_versions/lib/storage.php
@@ -44,6 +44,7 @@ namespace OCA\Files_Versions;
use OCA\Files_Versions\AppInfo\Application;
use OCA\Files_Versions\Command\Expire;
use OCP\Lock\ILockingProvider;
+use OCP\Files\NotFoundException;
class Storage {
@@ -74,15 +75,24 @@ class Storage {
/** @var \OCA\Files_Versions\AppInfo\Application */
private static $application;
+ /**
+ * @param string $filename
+ * @return array
+ * @throws \OC\User\NoUserException
+ */
public static function getUidAndFilename($filename) {
$uid = \OC\Files\Filesystem::getOwner($filename);
\OC\Files\Filesystem::initMountPoints($uid);
if ( $uid != \OCP\User::getUser() ) {
$info = \OC\Files\Filesystem::getFileInfo($filename);
$ownerView = new \OC\Files\View('/'.$uid.'/files');
- $filename = $ownerView->getPath($info['fileid']);
+ try {
+ $filename = $ownerView->getPath($info['fileid']);
+ } catch (NotFoundException $e) {
+ $filename = null;
+ }
}
- return array($uid, $filename);
+ return [$uid, $filename];
}
/**
diff --git a/apps/files_versions/tests/versions.php b/apps/files_versions/tests/versions.php
index 2979de2ac98..b9bc0932a84 100644
--- a/apps/files_versions/tests/versions.php
+++ b/apps/files_versions/tests/versions.php
@@ -759,7 +759,11 @@ class Test_Files_Versioning extends \Test\TestCase {
);
}
- private function createAndCheckVersions($view, $path) {
+ /**
+ * @param \OC\Files\View $view
+ * @param string $path
+ */
+ private function createAndCheckVersions(\OC\Files\View $view, $path) {
$view->file_put_contents($path, 'test file');
$view->file_put_contents($path, 'version 1');
$view->file_put_contents($path, 'version 2');
@@ -782,7 +786,6 @@ class Test_Files_Versioning extends \Test\TestCase {
/**
* @param string $user
* @param bool $create
- * @param bool $password
*/
public static function loginHelper($user, $create = false) {