Commit 2d335dc2 authored by Ryan Loong's avatar Ryan Loong

fix 文件导出

parent efa9fa81
...@@ -175,8 +175,9 @@ public class WxStorageController { ...@@ -175,8 +175,9 @@ public class WxStorageController {
} }
String type = storage.getType(); String type = storage.getType();
if(type.equals("application/x-zip-compressed")){
MediaType mediaType = MediaType.parseMediaType(type); MediaType mediaType = MediaType.parseMediaType(type);
if(type.equals("application/x-zip-compressed")){
Resource file = storageService.loadAsResource(key); Resource file = storageService.loadAsResource(key);
if(file == null) { if(file == null) {
ResponseEntity.notFound(); ResponseEntity.notFound();
...@@ -184,7 +185,6 @@ public class WxStorageController { ...@@ -184,7 +185,6 @@ public class WxStorageController {
return ResponseEntity.ok().contentType(mediaType).header(HttpHeaders.CONTENT_DISPOSITION, return ResponseEntity.ok().contentType(mediaType).header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + file.getFilename() + "\"").body(file); "attachment; filename=\"" + file.getFilename() + "\"").body(file);
} else if (type.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) { } else if (type.equals("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet")) {
MediaType mediaType = MediaType.parseMediaType(type);
Resource file = storageService.loadAsResource(key); Resource file = storageService.loadAsResource(key);
if(file == null) { if(file == null) {
ResponseEntity.notFound(); ResponseEntity.notFound();
...@@ -193,10 +193,6 @@ public class WxStorageController { ...@@ -193,10 +193,6 @@ public class WxStorageController {
"attachment; filename=\"" + URLEncoder.encode(storage.getName(), "UTF-8") + "\"").body(file); "attachment; filename=\"" + URLEncoder.encode(storage.getName(), "UTF-8") + "\"").body(file);
} }
MediaType mediaType = MediaType.parseMediaType(type);
Resource file = storageService.getLocalStorage().loadAsResource(key); Resource file = storageService.getLocalStorage().loadAsResource(key);
if (file == null) { if (file == null) {
return ResponseEntity.notFound().build(); return ResponseEntity.notFound().build();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment