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

Deprecate WebApp#mimeTypes #564

Merged
merged 1 commit into from
Jul 2, 2024
Merged
Show file tree
Hide file tree
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
6 changes: 1 addition & 5 deletions core/src/main/java/org/kohsuke/stapler/Stapler.java
Original file line number Diff line number Diff line change
Expand Up @@ -675,11 +675,7 @@ private String getMimeType(String fileName) {
idx = fileName.lastIndexOf('\\');
fileName = fileName.substring(idx + 1);

String extension = fileName.substring(fileName.lastIndexOf('.') + 1);
String mimeType = webApp.mimeTypes.get(extension);
if (mimeType == null) {
mimeType = getServletContext().getMimeType(fileName);
}
String mimeType = getServletContext().getMimeType(fileName);
if (mimeType == null) {
mimeType = "application/octet-stream";
}
Expand Down
3 changes: 3 additions & 0 deletions core/src/main/java/org/kohsuke/stapler/WebApp.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ public static WebApp get(ServletContext context) {
*
* This overrides whatever mappings given in the servlet as far as stapler is concerned.
* This is case insensitive, and should be normalized to lower case.
*
* @deprecated removed without replacement
*/
@Deprecated
public final Map<String, String> mimeTypes = new Hashtable<>();

private volatile ClassLoader classLoader;
Expand Down