Closed acalvo closed 2 years ago
Hi @acalvo,
Using application/octet-stream
in this case seems to be the correct behaviour for files without extensions, especially considering the webpack-dev-server
uses Express engine under the hood. Related test in webpack-dev-middleware
.
This also aligns with the spec found in https://tools.ietf.org/html/rfc2045
Any entity with an unrecognized Content-Transfer-Encoding must be treated as if it has a Content-Type of "application/octet-stream", regardless of what the Content-Type header field actually says.
Files without extensions are also handled different from one server engine to another, there is a good comparison here. I therefore don't recommand using a file without extension.
Closing as this seems to be working as design by Express engine.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: 12.x ### Description Until now, a file without extension was served by Angular in dev mode (`ng serve`) with the `; charset=UTF8` `Content-Type` header, which enabled the MIME type sniffing making the browser treat it correctly. With Angular 13 the header changed to `application/octet-stream` which made the browser try to download it. We set the appropriate headers to file in production, but this can't be done in the dev server as long as I know, so we relied in MIME type sniffing for dev mode until now. ## 🔬 Minimal Reproduction Create any asset without extension (for example a simple html file without extension), run `ng serve` and navigate to that URL. In Angular12 it'll be displayed, in Angular13 the browser will ask to download it. ## 🔥 Exception or Error - ## 🌍 Your Environment **Anything else relevant?**