Skip to content

Commit 0c6dfb2

Browse files
committed
Properly cast columns before joining
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent fccc637 commit 0c6dfb2

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

lib/Sharing/DeckShareProvider.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -692,8 +692,6 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset): arra
692692
break;
693693
}
694694

695-
// select s.id, dc.title, f.fileid, f.path from oc_share as s left join oc_filecache as f on s.file_source = f.fileid left join oc_storages as st on f.storage = st.numeric_id left join oc_deck_cards as dc on dc.id = s.share_with left join oc_deck_stacks as ds on dc.stack_id = ds.id inner join oc_deck_boards as db on ds.board_id = db.id WHERE db.id = 1;
696-
697695
$qb = $this->dbConnection->getQueryBuilder();
698696
$qb->select('s.*',
699697
'f.fileid', 'f.path', 'f.permissions AS f_permissions', 'f.storage', 'f.path_hash',
@@ -705,7 +703,7 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset): arra
705703
->orderBy('s.id')
706704
->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
707705
->leftJoin('f', 'storages', 'st', $qb->expr()->eq('f.storage', 'st.numeric_id'))
708-
->leftJoin('s', 'deck_cards', 'dc', $qb->expr()->eq('dc.id', 's.share_with'))
706+
->leftJoin('s', 'deck_cards', 'dc', $qb->expr()->eq($qb->expr()->castColumn('dc.id', IQueryBuilder::PARAM_STR), 's.share_with'))
709707
->leftJoin('dc', 'deck_stacks', 'ds', $qb->expr()->eq('dc.stack_id', 'ds.id'))
710708
->leftJoin('ds', 'deck_boards', 'db', $qb->expr()->eq('ds.board_id', 'db.id'));
711709

@@ -777,7 +775,7 @@ public function getSharedWithByType(int $cardId, int $shareType, $limit, $offset
777775
->orderBy('s.id')
778776
->leftJoin('s', 'filecache', 'f', $qb->expr()->eq('s.file_source', 'f.fileid'))
779777
->leftJoin('f', 'storages', 'st', $qb->expr()->eq('f.storage', 'st.numeric_id'))
780-
->leftJoin('s', 'deck_cards', 'dc', $qb->expr()->eq('dc.id', 's.share_with'));
778+
->leftJoin('s', 'deck_cards', 'dc', $qb->expr()->eq($qb->expr()->castColumn('dc.id', IQueryBuilder::PARAM_STR), 's.share_with'));
781779

782780
if ($limit !== -1) {
783781
$qb->setMaxResults($limit);

0 commit comments

Comments
 (0)