From 7f5b85166925f1d839f3362444f1064293788fad Mon Sep 17 00:00:00 2001 From: Hein Date: Tue, 11 Nov 2025 17:16:59 +0200 Subject: [PATCH] Empty sort appended bug fix --- pkg/restheadspec/handler.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/restheadspec/handler.go b/pkg/restheadspec/handler.go index b96e9ce..33978cc 100644 --- a/pkg/restheadspec/handler.go +++ b/pkg/restheadspec/handler.go @@ -293,6 +293,9 @@ func (h *Handler) handleRead(ctx context.Context, w common.ResponseWriter, id st logger.Debug("Applying expand: %s", expand.Relation) sorts := make([]common.SortOption, 0) for _, s := range strings.Split(expand.Sort, ",") { + if s == "" { + continue + } dir := "ASC" if strings.HasPrefix(s, "-") || strings.HasSuffix(strings.ToUpper(s), " DESC") { dir = "DESC" @@ -1531,6 +1534,9 @@ func (h *Handler) FetchRowNumber(ctx context.Context, tableName string, pkName s if len(options.Sort) > 0 { sortParts := make([]string, 0, len(options.Sort)) for _, sort := range options.Sort { + if sort.Column == "" { + continue + } direction := "ASC" if strings.EqualFold(sort.Direction, "desc") { direction = "DESC"