fix(utils): remove JMI for MimeType
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 4m48s
All checks were successful
Deploy Production Server / if_merged (pull_request) Successful in 4m48s
This commit is contained in:
parent
173f7ececa
commit
3258a8a12c
@ -11,6 +11,7 @@ import java.io.*;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URLConnection;
|
||||
import java.nio.file.Files;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
@ -77,12 +78,14 @@ public class Utils {
|
||||
|
||||
try (InputStream is = new BufferedInputStream(new ByteArrayInputStream(input))) {
|
||||
String mimeType = URLConnection.guessContentTypeFromStream(is);
|
||||
System.out.println(mimeType);
|
||||
/*try {
|
||||
mimeType = Magic.getMagicMatch(input, false).getMimeType();
|
||||
} catch (MagicParseException | MagicMatchNotFoundException | MagicException e) {
|
||||
mimeType = URLConnection.guessContentTypeFromStream(is);
|
||||
}*/
|
||||
String[] detectedExtensions = MimeTypes.findExtensionsByMimeTypes(mimeType, false);
|
||||
System.out.println(Arrays.toString(detectedExtensions));
|
||||
if (detectedExtensions.length == 0)
|
||||
throw new IOException("Fail to detect file extension for MIME type " + mimeType);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user