From 26d71cc86fc2288e347d6aea3cc0f7738e5e9a2d Mon Sep 17 00:00:00 2001
From: a <a@tuxpa.in>
Date: Mon, 17 Jun 2024 18:05:05 -0500
Subject: [PATCH] noot

---
 lib/gat/server.go | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/gat/server.go b/lib/gat/server.go
index 0dd5f243..1d46328e 100644
--- a/lib/gat/server.go
+++ b/lib/gat/server.go
@@ -121,11 +121,15 @@ func (T *Server) Serve(conn *fed.Conn) {
 		T.log.Warn("database not found", zap.String("user", conn.User), zap.String("database", conn.Database))
 		return nil
 	}))
-	for j := 0; j < len(T.routes); j++ {
+	//for j := 0; j < len(T.routes); j++ {
+	for j := len(T.routes) - 1; j >= 0; j-- {
 		route := T.routes[j]
 		if route.match != nil && !route.match.Matches(conn) {
 			continue
 		}
+		if route.handle == nil {
+			continue
+		}
 		composed = route.handle.Handle(composed)
 	}
 	err := composed.Route(conn)
-- 
GitLab