Fix SQL corruption in FindMatchingPattern by using strings.Replace

fmt.Sprintf interprets the literal % characters in the LIKE escape
clause as format verbs, corrupting the query and causing a 500 on
the /report endpoint.  Reorder tracker type / source filters in the
trackers page.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-05-11 17:42:51 +04:00
parent 10313069c8
commit 6bf1e54a50
2 changed files with 10 additions and 9 deletions

View File

@@ -19,6 +19,7 @@ import (
"errors"
"fmt"
"maps"
"strings"
"time"
"github.com/jackc/pgx/v5"
@@ -254,7 +255,7 @@ ORDER BY
LIMIT 1;
`
q = fmt.Sprintf(q, scope.SQLFragment())
q = strings.Replace(q, "%s", scope.SQLFragment(), 1)
args := pgx.StrictNamedArgs{
"cookie_banner_id": cookieBannerID,