Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The reason for this is to improve security in the application, a whitelist of allowed file types , and their content type, is included in the server.  Whenever a file is uploaded, we check the file extension against the list of allowed files and then check the file content against pre-defined standards, to ensure the file is in the format indicated by the extension.

...

To check content type:

Info

NOTE: Logs must should be at debug level for troubleshooting.  If necessary, you can set logging to "Debug", attempt the file upload and then switch the logs back to previous settings.  We need to capture the upload attempt to identify the file content type. 

In this example, we will attempt to import an .xlsx device message string saved by OpenOffice (this is not a filetype added by default to the server).

  1. With the logs in debug mode, attempt to upload the file you are having an issue with (keep a note of the exact filename)
  2. Navigate to Utility->Show Logs and download the latest log file (or console log in a split port server)
  3. Open the log file in a text editor and search for the filename that you attempted to import
  4. Locate the entry for "isContentTypesMatching" in the log file downloaded, this indicates where the file content is checked.  In the following example we have attempted to upload "ENU_DeviceMessages.xlsx", the entry in the logfile is:
    1. [2014-12-05 03:02:35,650]FATAL573969(StaticUtilities.java:1674) - isContentTypesMatching failed for 03-02-35 AM  ENU_DeviceMessages.xlsx, with Contenttype application/vnd.openxmlformats-officedocument.spreadsheetml.sheet. Configured Contenttype is application/vnd.ms-excel
  5. In the above log entry, we can see the following items:
    1. ENU_DeviceMessages.xlsx - this is the file we attemted to upload, the extension "xlsx" will be used to check the content type against our "File extensions" list
    2. with Contenttype application/vnd.openxmlformats-officedocument.spreadsheetml.sheet - this is the content type found within the file that was uploaded 
    3. Configured Contenttype is application/vnd.ms-excel - this is the content type configured in the admin console, as the file showed content of a different type, uploading was blocked

Therefore, in the admin console, we would need to add content type "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" to the list of acceptible content for xlsx files.  If this is done, the importing will succeed.

...