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
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=UTF8Content-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.
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.
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.
🐞 Bug report
Command (mark with an
x
)Is this a regression?
Yes, the previous version in which this bug was not present was: 12.xDescription
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 toapplication/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?
The text was updated successfully, but these errors were encountered: