diff --git a/appinfo/info.xml b/appinfo/info.xml
index f2ad233c..acf965ba 100755
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -29,7 +29,7 @@
https://github.com/owncloud/activity.git
-
+
diff --git a/lib/FilesHooks.php b/lib/FilesHooks.php
index 0738a524..8f7d875b 100755
--- a/lib/FilesHooks.php
+++ b/lib/FilesHooks.php
@@ -148,6 +148,11 @@ protected function addNotificationsForFileAction($filePath, $activityType, $subj
}
list($filePath, $uidOwner, $fileId) = $this->getSourcePathAndOwner($filePath);
+ if (!$fileId) {
+ // no owner, possibly deleted or unknown
+ // skip notifications
+ return;
+ }
$affectedUsers = $this->getUserPathsFromPath($filePath, $uidOwner);
$filteredStreamUsers = $this->userSettings->filterUsersBySetting(array_keys($affectedUsers), 'stream', $activityType);
$filteredEmailUsers = $this->userSettings->filterUsersBySetting(array_keys($affectedUsers), 'email', $activityType);
@@ -193,11 +198,19 @@ protected function getUserPathsFromPath($path, $uidOwner) {
* @return array
*/
protected function getSourcePathAndOwner($path) {
- $uidOwner = Filesystem::getOwner($path);
+ $currentUserView = Filesystem::getView();
+ $uidOwner = $currentUserView->getOwner($path);
$fileId = 0;
if ($uidOwner !== $this->currentUser) {
- Filesystem::initMountPoints($uidOwner);
+ list($storage, $internalPath) = $currentUserView->resolvePath($path);
+ if ($storage->instanceOfStorage('OCA\Files_Sharing\External\Storage')) {
+ // for federated shares we don't have access to the remote user, use the current one
+ // which will also make it use the matching local "shared::" federated share storage instead
+ $uidOwner = $this->currentUser;
+ } else {
+ Filesystem::initMountPoints($uidOwner);
+ }
}
$info = Filesystem::getFileInfo($path);
if ($info !== false) {