Skip to content

Commit 1504fae

Browse files
committed
Fix missed mime-type issue
1 parent 0216d09 commit 1504fae

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/express/ExpressUtils.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package express;
22

3+
import express.utils.MIMETypes;
4+
35
import java.io.*;
46

57
public class ExpressUtils {
@@ -35,11 +37,12 @@ public static String streamToString(InputStream is) {
3537
*/
3638
public static String getContentType(File file) {
3739
String filename = file.getAbsolutePath().replaceAll("^(.*\\.|.*\\|.+$)", "");
40+
String contentType = MIMETypes.get().get(filename);
3841

39-
if (filename == null)
40-
filename = "text/plain";
42+
if (contentType == null)
43+
contentType = "text/plain";
4144

42-
return filename;
45+
return contentType;
4346
}
4447

4548
}

0 commit comments

Comments
 (0)