同步代码
This commit is contained in:
@@ -30,7 +30,13 @@ public enum ContentTypeEnum {
|
||||
/**
|
||||
* GIF图片类型
|
||||
*/
|
||||
GIF("gif", "image/gif");
|
||||
GIF("gif", "image/gif"),
|
||||
|
||||
WEBP("webp", "image/webp"),
|
||||
|
||||
SVG("svg", "image/svg+xml"),
|
||||
|
||||
;
|
||||
|
||||
private final String extension;
|
||||
private final String contentType;
|
||||
@@ -41,13 +47,13 @@ public enum ContentTypeEnum {
|
||||
* @param extension 文件扩展名
|
||||
* @return 对应的内容类型,如果未找到则返回null
|
||||
*/
|
||||
public static String getContentType(String extension) {
|
||||
public static ContentTypeEnum ContentTypeEnum(String extension) {
|
||||
for (ContentTypeEnum type : values()) {
|
||||
if (type.extension.equalsIgnoreCase(extension)) {
|
||||
return type.contentType;
|
||||
return type;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return JPG;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user