You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[WASM] Files saved through the download fallback are padded with zeros on Safari 26+ #25684
On Safari 26 and later, every file saved with FileSavePicker through the download fallback is padded with zeros to a multiple of 2 MB:
a 16-byte file ("Hello, world!" written with FileIO.WriteTextAsync, so with a UTF-8 BOM) is saved as 2,097,152 bytes;
a 4,206,649-byte file is saved as 6,291,456 bytes.
The download picker stages the file in the origin-private file system in 2 MB chunks (#23880) and writes the last, partial chunk as chunk.subarray(0, n). Safari's FileSystemWritableFileStream.write() writes a view's whole underlying buffer, ignoring its byteOffset and byteLength: WebKit bug 302733, "FileSystemWritableFileStream.write() ignores byteOffset when writing TypedArray subarrays". So the whole 2 MB chunk is written, zeros included.
Seen in Safari 26.0.1 and 27.0 (iOS simulator) and 27.0.1 (macOS). Chrome writes only the view, so the saved file is correct there.
Expected behavior 🎯
The saved file has exactly the bytes that were written.
How to reproduce it (as minimally and precisely as possible) 🔬
In a WebAssembly app with the default WasmPickerConfiguration.FileSystemAccessApiWithFallback, served over HTTPS or from localhost, run in Safari 26 or later:
Activity