cmis: handle content_type parameter (#21807)
This commit is contained in:
parent
b2fe74db2f
commit
d030aa30d8
|
@ -111,6 +111,7 @@ class CmisConnector(BaseResource):
|
|||
filename,
|
||||
data['path'],
|
||||
data['file_byte_content'],
|
||||
content_type=data['file'].get('content_type'),
|
||||
object_type=data.get('object_type'),
|
||||
properties=data.get('properties'),
|
||||
)
|
||||
|
@ -186,10 +187,10 @@ class CMISGateway(object):
|
|||
|
||||
@wrap_cmis_error
|
||||
def create_doc(self, file_name, file_path, file_byte_content,
|
||||
object_type=None, properties=None):
|
||||
content_type=None, object_type=None, properties=None):
|
||||
folder = self._get_or_create_folder(file_path)
|
||||
properties = properties or {}
|
||||
if object_type:
|
||||
properties['cmis:objectTypeId'] = object_type
|
||||
return folder.createDocument(file_name, contentFile=BytesIO(file_byte_content),
|
||||
properties=properties)
|
||||
contentType=content_type, properties=properties)
|
||||
|
|
|
@ -45,7 +45,8 @@ def test_uploadfile(app, setup, tmpdir, monkeypatch):
|
|||
pass
|
||||
|
||||
def create_doc(self, file_name, file_path, file_byte_content,
|
||||
object_type=None, properties=None):
|
||||
content_type=None, object_type=None, properties=None):
|
||||
assert content_type == "image/jpeg"
|
||||
with open(file_name, 'wb') as f:
|
||||
f.write(file_byte_content)
|
||||
return Mock(properties={"toto": "tata"})
|
||||
|
@ -89,7 +90,7 @@ def test_uploadfile(app, setup, tmpdir, monkeypatch):
|
|||
def test_upload_file_metadata(app, setup, monkeypatch):
|
||||
|
||||
class FakeFolder:
|
||||
def createDocument(self, filename, contentFile, properties):
|
||||
def createDocument(self, filename, contentFile, properties, contentType=None):
|
||||
return Mock(properties=properties)
|
||||
|
||||
from passerelle.apps.cmis.models import CMISGateway
|
||||
|
|
Loading…
Reference in New Issue