diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/ContentType.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/ContentType.java index 75d9a9e4..a40ee7f1 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/ContentType.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/ContentType.java @@ -17,10 +17,16 @@ public String forPath(File p) { try { return Files.probeContentType(p.toPath()); } catch (Throwable e) { - return null; + return UNIVERSAL.forPath(p); } } + }, + UNIVERSAL { + @Override + public String forPath(File p) { + return "application/octet-stream"; + } + }; - public abstract String forPath(File p); } diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java index 4e146bed..04ca4018 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/socket/handlers/fileserver/FileServerHandler.java @@ -34,7 +34,7 @@ public class FileServerHandler extends SimpleChannelInboundHandler e.name().toLowerCase(Locale.US).equals(System.getProperty("launcher.fileserver.typeprobe", "nio"))).findFirst().orElse(ContentType.NONE); + private static final ContentType TYPE_PROBE = Arrays.stream(ContentType.values()).filter(e -> e.name().toLowerCase(Locale.US).equals(System.getProperty("launcher.fileserver.typeprobe", "nio"))).findFirst().orElse(ContentType.UNIVERSAL); private final Path base; private final boolean fullOut; private final boolean showHiddenFiles;