wails/v3/internal/assetserver/webview
Josh Ghiloni afbbcc9521
Check for empty buffers instead of nil in responsewriter (#4576)
* Check for empty buffers instead of nil in responsewriter

Use Case:

I am using a service that implements `http.Handler` to send streaming
video to the frontend. Reliably, when sending fragmented MP4 data on
MacOS, the app would panic because the buffer being sent through the
response passed a not-nil check but would panic when accessing the first
byte of the buffer.

This PR addresses that by checking if the buffer is not empty instead of
nil, accounting for the case where len(buf) == 0 and cap(buf) > 0, or
maybe where buf[0] == '\0' (I'm not sure how the nil checks work for
slices)

* Update UNRELEASED_CHANGELOG

* Update v3/internal/assetserver/webview/responsewriter_darwin.go

nil and len check

---------

Co-authored-by: Atterpac <89053530+atterpac@users.noreply.github.com>
2025-09-16 16:03:07 -04:00
..
request.go Move assetserver to internal 2023-08-14 08:31:55 +10:00
request_darwin.go [v3] Fix and optimise assetserver (#4049) 2025-02-09 00:02:54 +11:00
request_finalizer.go Move assetserver to internal 2023-08-14 08:31:55 +10:00
request_linux.go [V3-Linux] Upgrade to Webkitgtk4.1 (#3461) 2024-05-08 18:08:14 +10:00
request_linux_purego.go Move assetserver to internal 2023-08-14 08:31:55 +10:00
request_windows.go [v3] Fix and optimise assetserver (#4049) 2025-02-09 00:02:54 +11:00
responsewriter.go [windows] Serve assets async 2023-10-05 19:18:32 +11:00
responsewriter_darwin.go Check for empty buffers instead of nil in responsewriter (#4576) 2025-09-16 16:03:07 -04:00
responsewriter_linux.go [V3-Linux] Upgrade to Webkitgtk4.1 (#3461) 2024-05-08 18:08:14 +10:00
responsewriter_linux_purego.go [v3 linux] api changes (#2830) 2023-08-19 06:12:34 +10:00
responsewriter_windows.go [v3] Fix and optimise assetserver (#4049) 2025-02-09 00:02:54 +11:00
webkit2.go [V3-Linux] Upgrade to Webkitgtk4.1 (#3461) 2024-05-08 18:08:14 +10:00
webkit2_purego.go Move to latest webkit2 and remove older code. 2024-03-06 16:59:13 -06:00