Skip to content

Commit 3bdd7fd

Browse files
sdegueldreJulien00859
authored andcommitted
[FIX] http: force mimetype of .js files to text/javascript
Previously, when the odoo server was running on some Windows installations, it was possible for javascript files loaded directly from the static folder of an addon to fail to run because the Content-Type header was set to text/plain instead of text/javascript. This is because the mimetypes module from the standard library honors the mimetypes from the OS, in the case of Windows it reads a key in the registry, which can be misconfigured to text/plain for .js files. This commit forces the mimetype of .js files to text/javascript to solve this issue. closes odoo#162348 X-original-commit: 64cbe38 Signed-off-by: Julien Castiaux (juc) <[email protected]> Signed-off-by: Samuel Degueldre (sad) <[email protected]>
1 parent e51f0f0 commit 3bdd7fd

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

odoo/http.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,9 @@
214214
mimetypes.add_type('image/webp', '.webp')
215215
# Add potentially wrong (detected on windows) svg mime types
216216
mimetypes.add_type('image/svg+xml', '.svg')
217+
# this one can be present on windows with the value 'text/plain' which
218+
# breaks loading js files from an addon's static folder
219+
mimetypes.add_type('text/javascript', '.js')
217220

218221
# To remove when corrected in Babel
219222
babel.core.LOCALE_ALIASES['nb'] = 'nb_NO'

0 commit comments

Comments
 (0)