mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
[FIX] Более правильное определение ContentType.
This commit is contained in:
parent
9351cc1de5
commit
0dcd212d27
2 changed files with 9 additions and 3 deletions
|
@ -17,10 +17,16 @@ public String forPath(File p) {
|
||||||
try {
|
try {
|
||||||
return Files.probeContentType(p.toPath());
|
return Files.probeContentType(p.toPath());
|
||||||
} catch (Throwable e) {
|
} 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);
|
public abstract String forPath(File p);
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class FileServerHandler extends SimpleChannelInboundHandler<FullHttpReque
|
||||||
}
|
}
|
||||||
public static final int HTTP_CACHE_SECONDS = VerifyHelper.verifyInt(Integer.parseInt(System.getProperty("launcher.fileserver.cachesec", "60")), VerifyHelper.NOT_NEGATIVE, "HttpCache seconds should be positive");
|
public static final int HTTP_CACHE_SECONDS = VerifyHelper.verifyInt(Integer.parseInt(System.getProperty("launcher.fileserver.cachesec", "60")), VerifyHelper.NOT_NEGATIVE, "HttpCache seconds should be positive");
|
||||||
private static final boolean OLD_ALGO = Boolean.parseBoolean(System.getProperty("launcher.fileserver.oldalgo", "true"));
|
private static final boolean OLD_ALGO = Boolean.parseBoolean(System.getProperty("launcher.fileserver.oldalgo", "true"));
|
||||||
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.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 Path base;
|
||||||
private final boolean fullOut;
|
private final boolean fullOut;
|
||||||
private final boolean showHiddenFiles;
|
private final boolean showHiddenFiles;
|
||||||
|
|
Loading…
Reference in a new issue