Merge pull request #14083 from nextcloud/bugfix/noid/make-sure-the-path-is-always-a-string

Make sure the relative path is always a string
This commit is contained in:
Morris Jobke 2019-02-07 23:38:48 +01:00 committed by GitHub
commit 21671d5cb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 11 deletions

View File

@ -254,7 +254,7 @@ class ShareByMailProvider implements IShareProvider {
[$userFolder->getRelativePath($share->getNode()->getPath()), $share->getSharedWith()], [$userFolder->getRelativePath($share->getNode()->getPath()), $share->getSharedWith()],
$share->getSharedBy(), $share->getSharedBy(),
$share->getNode()->getId(), $share->getNode()->getId(),
$userFolder->getRelativePath($share->getNode()->getPath()) (string) $userFolder->getRelativePath($share->getNode()->getPath())
); );
if ($share->getShareOwner() !== $share->getSharedBy()) { if ($share->getShareOwner() !== $share->getSharedBy()) {
@ -264,11 +264,10 @@ class ShareByMailProvider implements IShareProvider {
$ownerPath = $nodes[0]->getPath(); $ownerPath = $nodes[0]->getPath();
$this->publishActivity( $this->publishActivity(
$type === 'share' ? Activity::SUBJECT_SHARED_EMAIL_BY : Activity::SUBJECT_UNSHARED_EMAIL_BY, $type === 'share' ? Activity::SUBJECT_SHARED_EMAIL_BY : Activity::SUBJECT_UNSHARED_EMAIL_BY,
Activity::SUBJECT_SHARED_EMAIL_BY,
[$ownerFolder->getRelativePath($ownerPath), $share->getSharedWith(), $share->getSharedBy()], [$ownerFolder->getRelativePath($ownerPath), $share->getSharedWith(), $share->getSharedBy()],
$share->getShareOwner(), $share->getShareOwner(),
$fileId, $fileId,
$ownerFolder->getRelativePath($ownerPath) (string) $ownerFolder->getRelativePath($ownerPath)
); );
} }
@ -291,7 +290,7 @@ class ShareByMailProvider implements IShareProvider {
[$userFolder->getRelativePath($share->getNode()->getPath())], [$userFolder->getRelativePath($share->getNode()->getPath())],
$share->getSharedBy(), $share->getSharedBy(),
$share->getNode()->getId(), $share->getNode()->getId(),
$userFolder->getRelativePath($share->getNode()->getPath()) (string) $userFolder->getRelativePath($share->getNode()->getPath())
); );
} else { } else {
$this->publishActivity( $this->publishActivity(
@ -299,7 +298,7 @@ class ShareByMailProvider implements IShareProvider {
[$userFolder->getRelativePath($share->getNode()->getPath()), $sharedWith], [$userFolder->getRelativePath($share->getNode()->getPath()), $sharedWith],
$share->getSharedBy(), $share->getSharedBy(),
$share->getNode()->getId(), $share->getNode()->getId(),
$userFolder->getRelativePath($share->getNode()->getPath()) (string) $userFolder->getRelativePath($share->getNode()->getPath())
); );
} }
} }
@ -308,13 +307,13 @@ class ShareByMailProvider implements IShareProvider {
/** /**
* publish activity if a file/folder was shared by mail * publish activity if a file/folder was shared by mail
* *
* @param $subject * @param string $subject
* @param $parameters * @param array $parameters
* @param $affectedUser * @param string $affectedUser
* @param $fileId * @param int $fileId
* @param $filePath * @param string $filePath
*/ */
protected function publishActivity($subject, $parameters, $affectedUser, $fileId, $filePath) { protected function publishActivity(string $subject, array $parameters, string $affectedUser, int $fileId, string $filePath) {
$event = $this->activityManager->generateEvent(); $event = $this->activityManager->generateEvent();
$event->setApp('sharebymail') $event->setApp('sharebymail')
->setType('shared') ->setType('shared')