From 6791053c83df83e9170c95e04f0fb06ecf0af538 Mon Sep 17 00:00:00 2001 From: DebaucheryLibrarian Date: Tue, 20 Oct 2020 21:04:29 +0200 Subject: [PATCH] Fixed entity alias available through wrong type endpoint. --- src/entities.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/entities.js b/src/entities.js index 899657c8..cff8b67a 100644 --- a/src/entities.js +++ b/src/entities.js @@ -141,8 +141,11 @@ async function fetchEntity(entityId, type) { if (type) { queryBuilder .where('entities.type', type) - .where('entities.slug', entityId) - .orWhere(knex.raw(':entityId = ANY(entities.alias)', { entityId })); + .where((whereBuilder) => { + whereBuilder + .where('entities.slug', entityId) + .orWhere(knex.raw(':entityId = ANY(entities.alias)', { entityId })); + }); return; }