fix bug 41161 【ie】图片显示不出来
This commit is contained in:
+9
-2
@@ -12,6 +12,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.constant.CommonConstant;
|
||||
import com.jero.common.system.api.ISysBaseAPI;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -170,7 +171,10 @@ public class CommonController {
|
||||
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes("UTF-8"),"iso-8859-1"));
|
||||
response.setContentType("application/force-download");// 设置强制下载不打开
|
||||
if (type == null) {
|
||||
if (fileName.contains(".jpg") || fileName.contains(".png") || fileName.contains(".gif") || fileName.contains(".jpeg")) {
|
||||
fileName = StringUtils.lowerCase(fileName);
|
||||
if (fileName.contains(".jpg") || fileName.contains(".gif") || fileName.contains(".jpeg")) {
|
||||
response.setContentType("image/jpeg;image/jpg;image/gif;image/png");
|
||||
} else if (fileName.contains(".png")) {
|
||||
response.setContentType("image/png;image/jpg;image/gif;image/jpeg");
|
||||
}
|
||||
}
|
||||
@@ -279,7 +283,10 @@ public class CommonController {
|
||||
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes("UTF-8"),"iso-8859-1"));
|
||||
response.setContentType("application/force-download");// 设置强制下载不打开
|
||||
if (type == null) {
|
||||
if (fileName.contains(".jpg") || fileName.contains(".png") || fileName.contains(".gif") || fileName.contains(".jpeg")) {
|
||||
fileName = StringUtils.lowerCase(fileName);
|
||||
if (fileName.contains(".jpg") || fileName.contains(".gif") || fileName.contains(".jpeg")) {
|
||||
response.setContentType("image/jpeg;image/jpg;image/gif;image/png");
|
||||
} else if (fileName.contains(".png")) {
|
||||
response.setContentType("image/png;image/jpg;image/gif;image/jpeg");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user