mirror of
https://github.com/nextcloud/server.git
synced 2026-06-09 08:44:07 -04:00
safer URL match in FileReferenceProvider
Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
This commit is contained in:
parent
2c05c2479e
commit
4ef2b27a47
1 changed files with 4 additions and 4 deletions
|
|
@ -62,21 +62,21 @@ class FileReferenceProvider implements IReferenceProvider {
|
|||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue