Skip to content

Make sure the relative path is always a string - #14083

Merged
MorrisJobke merged 2 commits into
masterfrom
bugfix/noid/make-sure-the-path-is-always-a-string
Feb 7, 2019
Merged

Make sure the relative path is always a string#14083
MorrisJobke merged 2 commits into
masterfrom
bugfix/noid/make-sure-the-path-is-always-a-string

Conversation

@nickvergessen

@nickvergessennickvergessen commented Feb 7, 2019

Copy link
Copy Markdown
Member

Not sure when this is triggered, but it happens:

publicfunctiongetRelativePath($path) {
if ($this->path === ''or$this->path === '/') {
return$this->normalizePath($path);
}
if ($path === $this->path) {
return'/';
} elseif (strpos($path, $this->path . '/') !== 0) {
returnnull;
} else {
$path = substr($path, strlen($this->path));
return$this->normalizePath($path);
}

Exception
TypeError: Argument 3 passed to OC\Activity\Event::setObject() must be of the type string, null given, called in /var/www/html/apps/sharebymail/lib/ShareByMailProvider.php on line 323
File "/var/www/html/lib/private/Activity/Event.php", line 377, in setObject
public function setObject(string $objectType, int $objectId, string $objectName = ''): IEvent {
File "sharebymail/lib/ShareByMailProvider.php", line 323, in publishActivity
->setObject('files', $fileId, $filePath);
File "sharebymail/lib/ShareByMailProvider.php", line 257, in createShareActivity
$userFolder->getRelativePath($share->getNode()->getPath())
File "sharebymail/lib/ShareByMailProvider.php", line 757, in delete
$this->createShareActivity($share, 'unshare');
File "/var/www/html/lib/private/Share20/Manager.php", line 979, in deleteShare
$provider->delete($share);
...
(13 additional frame(s) were not displayed)

Fix#14082

Signed-off-by: Joas Schilling <coding@schilljs.com>
@nickvergessen

Copy link
Copy Markdown
MemberAuthor

/backport to stable15

@nickvergessen

Copy link
Copy Markdown
MemberAuthor

Sentry issue: NEXTCLOUD-NP

@kesselbkesselb mentioned this pull request Feb 7, 2019
Comment threadapps/sharebymail/lib/ShareByMailProvider.php
Signed-off-by: Joas Schilling <coding@schilljs.com>

@rullzerrullzer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense.

@MorrisJobkeMorrisJobke left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and still works 👍

@MorrisJobke
MorrisJobke merged commit 21671d5 into masterFeb 7, 2019
@MorrisJobke
MorrisJobke deleted the bugfix/noid/make-sure-the-path-is-always-a-string branch February 7, 2019 22:38
@backportbot-nextcloud

Copy link
Copy Markdown

backport to stable15 in #14101

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@nickvergessen@rullzer@MorrisJobke@kesselb