summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMaxence Lange <maxence@artificial-owl.com>2023-04-03 15:04:11 -0100
committerGitHub <noreply@github.com>2023-04-03 15:04:11 -0100
commita3b4a222b40c2a7d2bccc7f42d3e35f7e7bfa672 (patch)
tree00d9fe0e181ec42a27c833943b5fc9f70077a82c
parent14942d966893766877b727ece5eda870ca18737e (diff)
parentc38073cb2b5db62e3f0c2a64259be3fa2043599a (diff)
Merge pull request #1712 from nextcloud/fix/noid/fix-out-of-range-ancestor
filter out of range ancestor
-rw-r--r--lib/Service/StreamService.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/Service/StreamService.php b/lib/Service/StreamService.php
index 52fd53ef..f619f132 100644
--- a/lib/Service/StreamService.php
+++ b/lib/Service/StreamService.php
@@ -355,7 +355,6 @@ class StreamService {
* @param int $nid
*
* @return array
- * @throws StreamNotFoundException
*/
public function getContextByNid(int $nid): array {
$curr = $post = $this->streamRequest->getStreamByNid($nid);
@@ -366,9 +365,13 @@ class StreamService {
break;
}
- $curr = $this->streamRequest->getStreamById($curr->getInReplyTo());
- $curr->setExportFormat(ACore::FORMAT_LOCAL);
- $ancestors[] = $curr;
+ try {
+ $curr = $this->streamRequest->getStreamById($curr->getInReplyTo(), true);
+ $curr->setExportFormat(ACore::FORMAT_LOCAL);
+ $ancestors[] = $curr;
+ } catch (StreamNotFoundException $e) {
+ break; // ancestor might be out of range for viewer
+ }
}
return [