From 8296433a219c502df46dd4c5a107a5dfcc2610eb Mon Sep 17 00:00:00 2001 From: "lilong.129" Date: Wed, 19 Feb 2025 21:22:56 +0800 Subject: [PATCH] fix: session not init in concatURL --- internal/version/VERSION | 2 +- pkg/uixt/driver_session.go | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/internal/version/VERSION b/internal/version/VERSION index 14788e68..61a91765 100644 --- a/internal/version/VERSION +++ b/internal/version/VERSION @@ -1 +1 @@ -v5.0.0+2502191738 +v5.0.0+2502192122 diff --git a/pkg/uixt/driver_session.go b/pkg/uixt/driver_session.go index 195b7833..2ada25f0 100644 --- a/pkg/uixt/driver_session.go +++ b/pkg/uixt/driver_session.go @@ -38,10 +38,15 @@ type DriverRequests struct { Error string `json:"error,omitempty"` } +const ( + rawSessionID = "" +) + func NewDriverSession() *DriverSession { timeout := 30 * time.Second session := &DriverSession{ ctx: context.Background(), + ID: rawSessionID, timeout: timeout, client: &http.Client{ Timeout: timeout, @@ -95,6 +100,11 @@ func (s *DriverSession) concatURL(urlStr string) (string, error) { return s.baseUrl, nil } + // replace with session ID + if s.ID != rawSessionID { + urlStr = strings.Replace(urlStr, rawSessionID, s.ID, 1) + } + // 处理完整 URL if strings.HasPrefix(urlStr, "http://") || strings.HasPrefix(urlStr, "https://") { u, err := url.Parse(urlStr)