Fix GetUserFiles SQL parameter order

This commit is contained in:
Leon Bösche
2026-01-09 20:31:05 +01:00
parent 8114a3746b
commit 6866f7fdab

View File

@@ -312,11 +312,11 @@ func (db *DB) GetUserFiles(ctx context.Context, userID uuid.UUID, path string, q
rows, err := db.QueryContext(ctx, `
SELECT id, org_id::text, user_id::text, name, path, type, size, last_modified, created_at
FROM files
WHERE user_id = $1 AND path != $2 AND path LIKE $2 || '/%'
AND ($4 = '' OR name ILIKE '%' || $4 || '%')
WHERE user_id = $1 AND path LIKE $2 || '%'
AND ($3 = '' OR name ILIKE '%' || $3 || '%')
ORDER BY name
LIMIT $5 OFFSET $6
`, userID, path, path, q, pageSize, offset)
LIMIT $4 OFFSET $5
`, userID, path, q, pageSize, offset)
if err != nil {
return nil, err
}