Fix session id that is an integer.

This commit is contained in:
Hein 2025-12-03 11:49:19 +02:00
parent 5ff9a8a24e
commit e35f8a4f14

View File

@ -757,8 +757,8 @@ func (h *Handler) replaceMetaVariables(sqlquery string, r *http.Request, userCtx
} }
if strings.Contains(sqlquery, "[rid_session]") { if strings.Contains(sqlquery, "[rid_session]") {
sessionID := userCtx.SessionID sessionID, _ := strconv.ParseInt(userCtx.SessionID, 10, 64)
sqlquery = strings.ReplaceAll(sqlquery, "[rid_session]", fmt.Sprintf("'%s'", sessionID)) sqlquery = strings.ReplaceAll(sqlquery, "[rid_session]", fmt.Sprintf("%d", sessionID))
} }
if strings.Contains(sqlquery, "[method]") { if strings.Contains(sqlquery, "[method]") {
@ -874,7 +874,7 @@ func IsNumeric(s string) bool {
// getReplacementForBlankParam determines the replacement value for an unused parameter // getReplacementForBlankParam determines the replacement value for an unused parameter
// based on whether it appears within quotes in the SQL query. // based on whether it appears within quotes in the SQL query.
// It checks for PostgreSQL quotes: single quotes ('') and dollar quotes ($...$) // It checks for PostgreSQL quotes: single quotes () and dollar quotes ($...$)
func getReplacementForBlankParam(sqlquery, param string) string { func getReplacementForBlankParam(sqlquery, param string) string {
// Find the parameter in the query // Find the parameter in the query
idx := strings.Index(sqlquery, param) idx := strings.Index(sqlquery, param)