test the new mime type detection

This commit is contained in:
bgamard
2022-01-17 14:37:22 +01:00
parent ee56cfe2b4
commit 3637b832e5
2 changed files with 5 additions and 1 deletions
@@ -27,7 +27,8 @@ public class MimeTypeUtil {
* @throws IOException e
*/
public static String guessMimeType(Path file, String name) throws IOException {
String mimeType = URLConnection.getFileNameMap().getContentTypeFor(name);
String mimeType = name == null ?
null : URLConnection.getFileNameMap().getContentTypeFor(name);
if (mimeType == null) {
try (InputStream is = Files.newInputStream(file)) {
final byte[] headerBytes = new byte[64];