Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebServer - MIME-Type for images not correct #1214

Closed
DaveSchmid opened this issue Jan 21, 2023 · 1 comment · Fixed by nanoframework/nanoFramework.WebServer#214
Closed

Comments

@DaveSchmid
Copy link
Contributor

Library/API/IoT binding

nanoFramework.WebServer

Visual Studio version

No response

.NET nanoFramework extension version

No response

Target name(s)

ESP32_REV0

Firmware version

1.8.0.877

Device capabilities

ESP32 (ESP32-D0WDQ6 (revision 1))
Features WiFi, BT, Dual Core, 240MHz, VRef calibration in efuse, Coding Scheme None
Flash size 4MB unknown from ST (manufacturer 0x32 device 0x16406)
PSRAM: undetermined
Crystal 40MHz
MAC 24:6F:28:9E:31:30

Description

MIME-Type for png images should be "image/png" not "image".
If the MIME type is wrong, the browser (Chrome) does not display the file but opens a save file dialog.

How to reproduce

  1. Start modified WebServer.Sample
  2. open Chrome request:
  3. analyzes Content types in Chrome Dev tool

2023-01-21_21-40-42

Expected behaviour

MIME type for the most important file extensions according to IANA. (or https://wiki.selfhtml.org/wiki/MIME-Type/%C3%9Cbersicht)

Screenshots

No response

Sample project or code

Modified WebServer.Sample with modified GetContentTypeFromFileName from WebServer.cs :
https://github.com/DaveSchmid/Samples/releases/tag/WebServer.Sample-Errors
Sample shows misbehave of wrong MIME-Type.

Aditional information

No response

@Ellerbach
Copy link
Member

You can directly pass the MIME type as an argument. Anyway, fixed for basic MIME types. Note that you'll have to pass the type for advance types. For space reasons and optimization, it only have a minimal number of types available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants