Class ExtensionCheckFacade


  • public class ExtensionCheckFacade
    extends Object
    Processes the extension check (i.e. the verification of a file's extension against its content) and reports the results.
    • Method Detail

      • isNotProcessable

        public static boolean isNotProcessable​(org.apache.commons.fileupload.FileItem fileItem)
        Returns:
        true, if the provided fiie item can't be processed by the extension check (e.g. because it has no name)
      • settings

        public static ExtensionCheckSettings settings()
        Returns:
        the current (system property based) extension check settings
      • systemMimeMapper

        public static Function<String,​String> systemMimeMapper()
        Returns:
        the MIME mapping functionality provided by the system (based on default and user-defined mappings)
      • reportExtensionMismatch

        public static MalwareScanReport reportExtensionMismatch​(org.apache.commons.fileupload.FileItem fileItem)
        Performs the extension check and creates a report if the check fails. In case of unexpected problems, corresponding log entries are written to the system protocol.
        Parameters:
        fileItem - the file item to process (must not be null)
        Returns:
        the check's result, either a description of the failed check wrapped by a malware scan report or null, if the extension matched the detected content type