SanitizeWhereClause with tablename on handlers.

This commit is contained in:
Hein
2025-11-21 11:00:44 +02:00
parent a931b8cdd2
commit 9a3564f05f
3 changed files with 35 additions and 5 deletions

View File

@@ -1209,7 +1209,7 @@ func (h *Handler) applyPreloads(model interface{}, query common.SelectQuery, pre
}
if len(preload.Where) > 0 {
sanitizedWhere := common.SanitizeWhereClause(preload.Where, preload.Relation)
sanitizedWhere := common.SanitizeWhereClause(preload.Where, reflection.ExtractTableNameOnly(preload.Relation))
if len(sanitizedWhere) > 0 {
sq = sq.Where(sanitizedWhere)
}