Commit 2773653
feature: refactor content type and MIME list (#241)
* feature: refactor content type and MIME list
This pull request refactors the _setContentTypeFromPath method in AsyncFileResponse to improve maintainability and performance in MIME type detection.
Key changes:
- More accurate fallback behavior, switching the default MIME type from text/plain to application/octet-stream for unknown file types.
- Formats Added:
.txt → text/plain
.opus → audio/opus (great compression, open and support in all modern browsers)
.webm → video/webm (great compression, open and support in all modern browsers)
- Formats Removed:
.zip → application/zip (send application/octet-stream. Browsers will always download it and not display it on the screen.)
.gz → application/x-gzip (send application/octet-stream. Browsers will always download it and not display it on the screen.)
.eot → font/eot (Font file. Obsolete, no longer supported in modern browsers.)
.ttf → font/ttf (Size it is too large for embedded systems. WOLF2 should be used.)
The update brings the function more in line with modern web and IoT usage while maintaining backward compatibility with legacy formats where still relevant.
Preguntar a ChatGPT
* Update src/WebResponses.cpp
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Add files via upload
Remove autoMINE extensions: zip, gz y eot
Add extensions: csv, opus, txt, webm
* Add files via upload
* ci(pre-commit): Apply automatic fixes
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: pre-commit-ci-lite[bot] <117423508+pre-commit-ci-lite[bot]@users.noreply.github.com>
Co-authored-by: Mathieu Carbou <mathieu.carbou@gmail.com>1 parent ec133bb commit 2773653
2 files changed
Lines changed: 38 additions & 34 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
631 | 631 | | |
632 | 632 | | |
633 | 633 | | |
634 | | - | |
| 634 | + | |
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
| |||
663 | 663 | | |
664 | 664 | | |
665 | 665 | | |
666 | | - | |
667 | | - | |
668 | 666 | | |
669 | 667 | | |
670 | 668 | | |
671 | 669 | | |
672 | 670 | | |
673 | 671 | | |
674 | | - | |
675 | | - | |
676 | | - | |
677 | | - | |
678 | | - | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
679 | 677 | | |
| 678 | + | |
| 679 | + | |
680 | 680 | | |
681 | 681 | | |
682 | 682 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
128 | 130 | | |
129 | 131 | | |
| 132 | + | |
130 | 133 | | |
131 | | - | |
132 | 134 | | |
133 | | - | |
134 | | - | |
| 135 | + | |
135 | 136 | | |
136 | 137 | | |
137 | 138 | | |
| |||
143 | 144 | | |
144 | 145 | | |
145 | 146 | | |
| 147 | + | |
146 | 148 | | |
147 | 149 | | |
| 150 | + | |
148 | 151 | | |
149 | | - | |
150 | 152 | | |
| 153 | + | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
0 commit comments