monkeypatch NamedBlobFile to always ignore browser supplied mime type (#6337)
This commit is contained in:
parent
376b307b17
commit
7ee4fc345b
|
@ -3,6 +3,7 @@
|
|||
xmlns:five="http://namespaces.zope.org/five"
|
||||
xmlns:grok="http://namespaces.zope.org/grok"
|
||||
xmlns:i18n="http://namespaces.zope.org/i18n"
|
||||
xmlns:monkey="http://namespaces.plone.org/monkey"
|
||||
xmlns:genericsetup="http://namespaces.zope.org/genericsetup"
|
||||
xmlns:cmf="http://namespaces.zope.org/cmf"
|
||||
i18n_domain="pfwbged.policy">
|
||||
|
@ -69,4 +70,14 @@
|
|||
|
||||
<adapter factory=".customize.DefaultDashboard" />
|
||||
|
||||
<include package="collective.monkeypatcher" />
|
||||
|
||||
<monkey:patch
|
||||
description="Always ignore browser-supplied MIME type"
|
||||
class="plone.namedfile.file.NamedBlobFile"
|
||||
original="__init__"
|
||||
preserveOriginal="true"
|
||||
replacement=".monkey.patchedNamedBlobFileInit"
|
||||
/>
|
||||
|
||||
</configure>
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
def patchedNamedBlobFileInit(self, data='', contentType='', filename=None):
|
||||
if filename:
|
||||
contentType = ''
|
||||
self._old___init__(data=data, contentType=contentType, filename=filename)
|
Reference in New Issue