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
Darwin 23.4.0 arm64 arm
(same behavior with same Bun version on a Linux Ubuntu 20.22 virtual server x86_64)
What steps can reproduce the bug?
There seems to be a bug in Bun.file when using in a Response() from Bun.serve(). I detected this problem as I tried to served a cached rss.xml file, my feed reader reliably refused to accept this file, even though everything else seemed fine, even the online RSS validators did liked my feed endpoint. I tracked this problem down to a suspicious Content-Disposition header, that was only present for this feed endpoint, all other cached files did not show this additional header.
[Update: Further testing show that the Content-Disposition header do show up in other endpoints too, but only the RSS reader seems to have a problem with this (or with other side effects I have not yet understood/tracked down).]
relevant (working) code snippet (see repo for full code):
I rewrote my code to using async, but the described problem with using bare Bun.file() in a Response() persists. Using await Bun.file().arrayBuffer() works fine though, at the small cost that I have to get Content-Type now manually with Bun.file().type.
What version of Bun is running?
1.1.8+89d25807f
What platform is your computer?
Darwin 23.4.0 arm64 arm
(same behavior with same Bun version on a Linux Ubuntu 20.22 virtual server x86_64)
What steps can reproduce the bug?
There seems to be a bug in Bun.file when using in a
Response()
fromBun.serve()
. I detected this problem as I tried to served a cachedrss.xml
file, my feed reader reliably refused to accept this file, even though everything else seemed fine, even the online RSS validators did liked my feed endpoint. I tracked this problem down to a suspiciousContent-Disposition
header, that was only present for this feed endpoint, all other cached files did not show this additional header.[Update: Further testing show that the
Content-Disposition
header do show up in other endpoints too, but only the RSS reader seems to have a problem with this (or with other side effects I have not yet understood/tracked down).]relevant (working) code snippet (see repo for full code):
When I use
Bun.file()
instead offs.readFileSync()
I see the problems described above, below are somecurl
traces with additional information.Note the content-disposition header:
Sometimes I see spurious excess warnings and closing connections:
Generating directly works (wihout using Bun.file to serve a cached gzipped file):
Using fs.readFileSync instead of Bun.file works flawlessly serving the cached gzipped files:
What is the expected behavior?
Bun.file serving the file without problems like fs.readFileSync
What do you see instead?
See above.
Additional information
No response
The text was updated successfully, but these errors were encountered: