@Override
    @SuppressFBWarnings("PATH_TRAVERSAL_IN") // suppressing because we are using the getValidFilePath
    public String getMimeType(String file) {
        if (file == null || !file.contains(".")) {
            return null;
        }

        String mimeType = null;

        // may not work on Lambda until mailcap package is present https://github.com/aws/serverless-java-container/pull/504
        try {
            mimeType = Files.probeContentType(Paths.get(file));
        } catch (IOException | InvalidPathException e) {
            log("unable to probe for content type, will use fallback", e);
        }

        if (mimeType == null) {
            try {
                String mimeTypeGuess = URLConnection.guessContentTypeFromName(new File(file).getName());
                if (mimeTypeGuess !=null) {
                    mimeType = mimeTypeGuess;
                }
            } catch (Exception e) {
                log("couldn't find a better contentType than " + mimeType + " for file " + file, e);
            }
        }

        return mimeType;
    }
@Test
    void getMimeType_unknownExtension_expectNull() {
        AwsServletContext ctx = new AwsServletContext(null);
        String mimeType = ctx.getMimeType("myfile.unkext");
        assertNull(mimeType);
    }