Creatio File API and MinIO storage: how to set correct Content-Type/MIME for uploaded files?
Hello everyone
We are integrating Creatio File management API with MinIO (S3-compatible object storage). The files are successfully uploaded to MinIO, but the object metadata in MinIO has an incorrect Content-Type (it ends up as text/plain). This becomes a real issue in the browser - when opening the direct MinIO object URL, the browser does not render images (PNG) because MinIO returns:
Content-Type: text/plain
X-Content-Type-Options: nosniff
What we do in Creatio:
IFileFactory fileFactory = UserConnection.GetFileFactory(); var fileLocator = new EntityFileLocator("PromotionFile", imageId); IFile file = fileFactory.Create(fileLocator); file.Name = fileName; file.SetAttribute("PromotionId", promotionId); file.Save(); fileStream.Position = 0; file.Write(fileStream, FileWriteOptions.SinglePart);
Expected behavior
When uploading a PNG (or any file), MinIO should store and return the correct Content-Type (e.g. image/png) so that direct browser access works.
Actual behavior
The uploaded object in MinIO still has wrong Content-Type (text/plain), as if Creatio ignores the file extension.
Questions
Does Creatio File API support setting the Content-Type for the underlying storage object especially for MinIO?
Like