SAP Knowledge Base Article - Public

3047076 - Mime Type Issues When Downloading Attachments

Symptom

  • Files are downloaded with unexpected file extension
  • Files are downloaded without a file extension

Environment

SAP Business ByDesign
SAP Cloud for Customer

Cause

When attachments are uploaded, their mime type is determined based on the extension of the file name (e.g. example_file.pdf results in mime type “application/pdf”).

You map mime types and extensions and specify which mime types may be uploaded in the activity “Allowed MIME Types for Document Upload” in Business Configuration.

If the mime type cannot be determined from the file extension because the file extension is not maintained, mime type “application/octet-stream” is automatically used instead. Due to this behavior, we recommend not allowing  mime type “application/octet-stream” without a purpose to prevent, for instance, the upload of executable or other unwanted file types.

In integration scenarios (SOAP, OData) the sender may specify the mime type. In this case, the mime type is used as specified and not determined based on the extension.

When downloading an attachment, the extension of the file name is used. If no extension is available or the extension doesn’t match the mime type, the maintained default extension of the mime type will be used.

Resolution

In the Business Configuration activity “Allowed MIME Types for Document Upload”:

  • Do not assign the same extension to a forbidden and an allowed mime type at the same time. For example, You add 2 new MimeTypes (eg:  ZABC and ZDEF) but should not have same extension assigned. This should be avoided
  • We recommend not to allow mime type “application/octet-stream”.

In integration scenarios

  • Ensure that the file name contains an appropriate extension (e.g. the <Name> tag in SOAP messages).
  • If the mime type is specified in integration scenarios, ensure the mime type / file extension matches the setting in “Allowed MIME Types for Document Upload” to avoid unwanted changes of the extension during download.

Example:

Here in the below screenshot, it is standard png file extension added to one of the MIMETYPE Code which is already allowed.

png.png

In this below screenshot you have created custom file extension for png again for different MIMETYPE Code.

png 1.png

Keywords

Mime types, attachments, file extension , KBA , AP-RC-DOC , Document Centric Application Service , Problem

Product

SAP Business ByDesign all versions ; SAP Cloud for Customer add-ins all versions