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

[FIX] base: set mimetype on js and css assets #20731

Merged
merged 1 commit into from Nov 7, 2017

Conversation

d-fence
Copy link
Contributor

@d-fence d-fence commented Nov 6, 2017

Description of the issue/feature this PR addresses:
On MS Windows, the mimetypes module relies on the Windows Registry to
guess mimetypes. As a consequence, when generating assets bundle for
javascript files, the mime type of js files may be wrong. In that
particular case, the Odoo user is facing an empty web page.
This commit enforce 'application/javascript' for js assets when they are
saved as ir_attachment in the database.

--
I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr

@d-fence d-fence requested a review from xmo-odoo November 6, 2017 16:07
Copy link
Collaborator

@xmo-odoo xmo-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ça m'a l'air bien, juste enlever les parenthèses autour de l'expression dans le assert (c'est un statement)

@xmo-odoo
Copy link
Collaborator

xmo-odoo commented Nov 6, 2017

Alternativement si on craint de pêter des trucs (genre des tiers bizarres qui appelleraient cette fonction, normalement ça n'arrive pas mais bon…) on peut ne spécifier le mimetype que si c'est un type "connu" (js ou css) et pour les autres types ça bouge pas.

On MS Windows, the mimetypes module relies on the Windows Registry to
guess mimetypes. As a consequence, when generating assets bundle for
javascript files, the mime type of js files may be wrong. In that
particular case, the Odoo user is facing an empty web page.
This commit enforce 'application/javascript' for js assets when they are
saved as ir_attachment in the database.
@d-fence d-fence force-pushed the 11.0-fix-assets-mimetype-moc branch from 335cb6e to 77ca51f Compare November 7, 2017 08:29
@d-fence d-fence merged commit 77ca51f into odoo:11.0 Nov 7, 2017
@d-fence d-fence mentioned this pull request Nov 22, 2017
@d-fence d-fence deleted the 11.0-fix-assets-mimetype-moc branch November 22, 2017 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants