Skip to content

Commit

Permalink
Merge pull request #36637 from nextcloud/fix/noid/file-ref-provider-s…
Browse files Browse the repository at this point in the history
…afer-match
  • Loading branch information
nickvergessen authored Feb 9, 2023
2 parents 6d77a53 + 4ef2b27 commit f0b6a6f
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,21 @@ public function matchReference(string $referenceText): bool {
}

private function getFilesAppLinkId(string $referenceText): ?int {
$start = $this->urlGenerator->getAbsoluteURL('/apps/files');
$startIndex = $this->urlGenerator->getAbsoluteURL('/index.php/apps/files');
$start = $this->urlGenerator->getAbsoluteURL('/apps/files/');
$startIndex = $this->urlGenerator->getAbsoluteURL('/index.php/apps/files/');

$fileId = null;

if (mb_strpos($referenceText, $start) === 0) {
$parts = parse_url($referenceText);
parse_str($parts['query'], $query);
parse_str($parts['query'] ?? '', $query);
$fileId = isset($query['fileid']) ? (int)$query['fileid'] : $fileId;
$fileId = isset($query['openfile']) ? (int)$query['openfile'] : $fileId;
}

if (mb_strpos($referenceText, $startIndex) === 0) {
$parts = parse_url($referenceText);
parse_str($parts['query'], $query);
parse_str($parts['query'] ?? '', $query);
$fileId = isset($query['fileid']) ? (int)$query['fileid'] : $fileId;
$fileId = isset($query['openfile']) ? (int)$query['openfile'] : $fileId;
}
Expand Down

0 comments on commit f0b6a6f

Please sign in to comment.