diff options
author | Bjoern Schiessle <schiessle@owncloud.com> | 2014-12-23 12:40:52 +0100 |
---|---|---|
committer | Bjoern Schiessle <schiessle@owncloud.com> | 2014-12-23 13:32:54 +0100 |
commit | 8c48be453ec39f7a6283c7087229ed76fe128d0a (patch) | |
tree | 023b661d0047c6d930f837c334cf2e5ba63d9e70 | |
parent | 5352b4b2b83c5f141f68194c77c239753da30b9e (diff) | |
download | nextcloud-server-8c48be453ec39f7a6283c7087229ed76fe128d0a.tar.gz nextcloud-server-8c48be453ec39f7a6283c7087229ed76fe128d0a.zip |
only send activity if we have a valid path and the file is readable
-rw-r--r-- | apps/files_sharing/lib/controllers/sharecontroller.php | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/apps/files_sharing/lib/controllers/sharecontroller.php b/apps/files_sharing/lib/controllers/sharecontroller.php index 8b04fbd0341..69de717611c 100644 --- a/apps/files_sharing/lib/controllers/sharecontroller.php +++ b/apps/files_sharing/lib/controllers/sharecontroller.php @@ -231,22 +231,20 @@ class ShareController extends Controller { $originalSharePath = self::getPath($token); if (isset($originalSharePath) && Filesystem::isReadable($originalSharePath . $path)) { - $getPath = Filesystem::normalizePath($path); - $originalSharePath = Filesystem::normalizePath($originalSharePath . $getPath); - $type = \OC\Files\Filesystem::is_dir($originalSharePath) ? 'folder' : 'file'; - $args = $type === 'folder' ? array('dir' => $originalSharePath) : array('dir' => dirname($originalSharePath), 'scrollto' => basename($originalSharePath)); - $linkToFile = \OCP\Util::linkToAbsolute('files', 'index.php', $args); + $originalSharePath = Filesystem::normalizePath($originalSharePath . $path); + $type = \OC\Files\Filesystem::is_dir($originalSharePath) ? 'folder' : 'file'; + $args = $type === 'folder' ? array('dir' => $originalSharePath) : array('dir' => dirname($originalSharePath), 'scrollto' => basename($originalSharePath)); + $linkToFile = \OCP\Util::linkToAbsolute('files', 'index.php', $args); + $subject = $type === 'folder' ? Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED : Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED; + $this->activityManager->publishActivity( + 'files_sharing', $subject, array($originalSharePath), '', array(), $originalSharePath, + $linkToFile, $linkItem['uid_owner'], Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM); } - $subject = $type === 'folder' ? Activity::SUBJECT_PUBLIC_SHARED_FOLDER_DOWNLOADED : Activity::SUBJECT_PUBLIC_SHARED_FILE_DOWNLOADED; - $this->activityManager->publishActivity( - 'files_sharing', $subject, array($originalSharePath), '', array(), - $originalSharePath, $linkToFile, $linkItem['uid_owner'], Activity::TYPE_PUBLIC_LINKS, Activity::PRIORITY_MEDIUM); - if (!is_null($files)) { // download selected files $files_list = json_decode($files); // in case we get only a single file - if ($files_list === NULL ) { + if ($files_list === NULL) { $files_list = array($files); } |