Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(emx2): changed the mimetype logic #4358

Merged
merged 4 commits into from
Oct 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
import io.javalin.Javalin;
import io.javalin.http.Context;
import java.io.InputStream;
import java.net.URLConnection;
import java.nio.file.Files;
import java.nio.file.Path;

/**
* to allow for nice urls, and make it easier for 'schema' app developers we include the schema in
Expand Down Expand Up @@ -88,7 +89,7 @@ public static void addFileToContext(Context ctx, String path, String mimeType) {
return;
}
if (mimeType == null) {
mimeType = URLConnection.guessContentTypeFromName(path);
mimeType = Files.probeContentType(Path.of(path));
if (mimeType == null) {
mimeType = "application/octet-stream";
}
Expand Down