chore: switch purego dependency to bnema/purego fork
Replace local path replace directive with GitHub URL pointing to bnema/purego@91aa177. Also fix CEF response headers to split MIME type and charset for correct content-type handling.
- commit
- 62d919ec3bb0fcd598b14dd03bc4f064c08bf673
- author
- brice · · 2026-03-23 19:51 UTC
- committer
- brice · · 2026-03-28 04:38 UTC
- parent
- 4da3a75
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
3 files · +25 -3
M go.mod +2 -2
| @@ -29,8 +29,6 @@ replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-202603230 | |||
| 29 | 29 | ||
| 30 | 30 | replace github.com/bnema/purego-cef => ../purego-cef | |
| 31 | 31 | ||
| 32 | - | replace github.com/ebitengine/purego => ../purego | |
| 33 | - | ||
| 34 | 32 | require ( | |
| 35 | 33 | github.com/atotto/clipboard v0.1.4 // indirect | |
| 36 | 34 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect | |
| @@ -80,3 +78,5 @@ require ( | |||
| 80 | 78 | modernc.org/mathutil v1.7.1 // indirect | |
| 81 | 79 | modernc.org/memory v1.11.0 // indirect | |
| 82 | 80 | ) | |
| 81 | + | ||
| 82 | + | replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 | |
| @@ -29,8 +29,6 @@ replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-202603230 | |||||
| 29 | 29 | ||||
| 30 | replace github.com/bnema/purego-cef => ../purego-cef | 30 | replace github.com/bnema/purego-cef => ../purego-cef | ||
| 31 | 31 | ||||
| 32 | - | replace github.com/ebitengine/purego => ../purego | |||
| 33 | - | ||||
| 34 | require ( | 32 | require ( | ||
| 35 | github.com/atotto/clipboard v0.1.4 // indirect | 33 | github.com/atotto/clipboard v0.1.4 // indirect | ||
| 36 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect | 34 | github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect | ||
| @@ -80,3 +78,5 @@ require ( | |||||
| 80 | modernc.org/mathutil v1.7.1 // indirect | 78 | modernc.org/mathutil v1.7.1 // indirect | ||
| 81 | modernc.org/memory v1.11.0 // indirect | 79 | modernc.org/memory v1.11.0 // indirect | ||
| 82 | ) | 80 | ) | ||
| 81 | + | ||||
| 82 | + | replace github.com/ebitengine/purego => github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 | |||
M go.sum +2 -0
| @@ -4,6 +4,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE | |||
| 4 | 4 | github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= | |
| 5 | 5 | github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY= | |
| 6 | 6 | github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= | |
| 7 | + | github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 h1:0GaiO4102gOdp0es0MO2d0bRSvyeMw5A2D4F4WdIw0k= | |
| 8 | + | github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= | |
| 7 | 9 | github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc= | |
| 8 | 10 | github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E= | |
| 9 | 11 | github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= | |
| @@ -4,6 +4,8 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiE | |||||
| 4 | github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= | 4 | github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= | ||
| 5 | github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY= | 5 | github.com/aymanbagabas/go-udiff v0.3.1 h1:LV+qyBQ2pqe0u42ZsUEtPiCaUoqgA9gYRDs3vj1nolY= | ||
| 6 | github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= | 6 | github.com/aymanbagabas/go-udiff v0.3.1/go.mod h1:G0fsKmG+P6ylD0r6N/KgQD/nWzgfnl8ZBcNLgcbrw8E= | ||
| 7 | + | github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704 h1:0GaiO4102gOdp0es0MO2d0bRSvyeMw5A2D4F4WdIw0k= | |||
| 8 | + | github.com/bnema/purego v0.0.0-20260323095903-91aa177a2704/go.mod h1:iIjxzd6CiRiOG0UyXP+V1+jWqUXVjPKLAI0mRfJZTmQ= | |||
| 7 | github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc= | 9 | github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc= | ||
| 8 | github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E= | 10 | github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E= | ||
| 9 | github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= | 11 | github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw= | ||
M internal/infrastructure/cef/scheme_handler.go +21 -1
| @@ -247,6 +247,20 @@ func getMimeType(filename string) string { | |||
| 247 | 247 | } | |
| 248 | 248 | } | |
| 249 | 249 | ||
| 250 | + | // splitMimeCharset splits "text/html; charset=utf-8" into ("text/html", "utf-8"). | |
| 251 | + | // If no charset parameter is present, charset is empty. | |
| 252 | + | func splitMimeCharset(contentType string) (mimeType, charset string) { | |
| 253 | + | parts := strings.SplitN(contentType, ";", 2) | |
| 254 | + | mimeType = strings.TrimSpace(parts[0]) | |
| 255 | + | if len(parts) > 1 { | |
| 256 | + | param := strings.TrimSpace(parts[1]) | |
| 257 | + | if strings.HasPrefix(strings.ToLower(param), "charset=") { | |
| 258 | + | charset = strings.TrimSpace(param[len("charset="):]) | |
| 259 | + | } | |
| 260 | + | } | |
| 261 | + | return | |
| 262 | + | } | |
| 263 | + | ||
| 250 | 264 | // --------------------------------------------------------------------------- | |
| 251 | 265 | // ResourceHandler implementation | |
| 252 | 266 | // --------------------------------------------------------------------------- | |
| @@ -294,9 +308,15 @@ func (rh *staticResourceHandler) ProcessRequest(_ purecef.Request, _ purecef.Cal | |||
| 294 | 308 | } | |
| 295 | 309 | ||
| 296 | 310 | // GetResponseHeaders sets status code, MIME type, and content length. | |
| 311 | + | // CEF's SetMimeType expects the MIME type without charset parameters; | |
| 312 | + | // the charset must be set separately via SetCharset. | |
| 297 | 313 | func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, responseLength unsafe.Pointer, _ uintptr) { | |
| 298 | 314 | response.SetStatus(int32(rh.statusCode)) | |
| 299 | - | response.SetMimeType(rh.contentType) | |
| 315 | + | mimeType, charset := splitMimeCharset(rh.contentType) | |
| 316 | + | response.SetMimeType(mimeType) | |
| 317 | + | if charset != "" { | |
| 318 | + | response.SetCharset(charset) | |
| 319 | + | } | |
| 300 | 320 | *(*int64)(responseLength) = int64(len(rh.data)) | |
| 301 | 321 | } | |
| 302 | 322 | ||
| @@ -247,6 +247,20 @@ func getMimeType(filename string) string { | |||||
| 247 | } | 247 | } | ||
| 248 | } | 248 | } | ||
| 249 | 249 | ||||
| 250 | + | // splitMimeCharset splits "text/html; charset=utf-8" into ("text/html", "utf-8"). | |||
| 251 | + | // If no charset parameter is present, charset is empty. | |||
| 252 | + | func splitMimeCharset(contentType string) (mimeType, charset string) { | |||
| 253 | + | parts := strings.SplitN(contentType, ";", 2) | |||
| 254 | + | mimeType = strings.TrimSpace(parts[0]) | |||
| 255 | + | if len(parts) > 1 { | |||
| 256 | + | param := strings.TrimSpace(parts[1]) | |||
| 257 | + | if strings.HasPrefix(strings.ToLower(param), "charset=") { | |||
| 258 | + | charset = strings.TrimSpace(param[len("charset="):]) | |||
| 259 | + | } | |||
| 260 | + | } | |||
| 261 | + | return | |||
| 262 | + | } | |||
| 263 | + | ||||
| 250 | // --------------------------------------------------------------------------- | 264 | // --------------------------------------------------------------------------- | ||
| 251 | // ResourceHandler implementation | 265 | // ResourceHandler implementation | ||
| 252 | // --------------------------------------------------------------------------- | 266 | // --------------------------------------------------------------------------- | ||
| @@ -294,9 +308,15 @@ func (rh *staticResourceHandler) ProcessRequest(_ purecef.Request, _ purecef.Cal | |||||
| 294 | } | 308 | } | ||
| 295 | 309 | ||||
| 296 | // GetResponseHeaders sets status code, MIME type, and content length. | 310 | // GetResponseHeaders sets status code, MIME type, and content length. | ||
| 311 | + | // CEF's SetMimeType expects the MIME type without charset parameters; | |||
| 312 | + | // the charset must be set separately via SetCharset. | |||
| 297 | func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, responseLength unsafe.Pointer, _ uintptr) { | 313 | func (rh *staticResourceHandler) GetResponseHeaders(response purecef.Response, responseLength unsafe.Pointer, _ uintptr) { | ||
| 298 | response.SetStatus(int32(rh.statusCode)) | 314 | response.SetStatus(int32(rh.statusCode)) | ||
| 299 | - | response.SetMimeType(rh.contentType) | 315 | + | mimeType, charset := splitMimeCharset(rh.contentType) |
| 316 | + | response.SetMimeType(mimeType) | |||
| 317 | + | if charset != "" { | |||
| 318 | + | response.SetCharset(charset) | |||
| 319 | + | } | |||
| 300 | *(*int64)(responseLength) = int64(len(rh.data)) | 320 | *(*int64)(responseLength) = int64(len(rh.data)) | ||
| 301 | } | 321 | } | ||
| 302 | 322 | ||||