Skip to content

Commit

Permalink
Added a fix for mime type parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
JanHolger committed Oct 24, 2023
1 parent 939065e commit 3839de6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

public class HeaderValue {

final String value;
final Map<String, String> directives = new HashMap<>();
private final String value;
private final Map<String, String> directives = new HashMap<>();

public HeaderValue(String source) {
String[] spl = source.split("; ");
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/org/javawebstack/http/router/util/MimeType.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ public static MimeType byExtension(String extension) {
}

public static MimeType byMimeType(String mimeType) {
if(mimeType == null)
return null;
if(mimeType.contains(";"))
mimeType = new HeaderValue(mimeType).getValue();
for (MimeType type : values()) {
if (type.mimeTypes.contains(mimeType)) {
return type;
Expand Down

0 comments on commit 3839de6

Please sign in to comment.