Commit efa9fa81 authored by Ryan Loong's avatar Ryan Loong

fix 文件导出

parent a5fc2b61
......@@ -27,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
......@@ -161,7 +162,7 @@ public class WxStorageController {
* @return
*/
@GetMapping("/fetch/{key:.+}")
public ResponseEntity<Resource> fetch(@PathVariable String key) {
public ResponseEntity<Resource> fetch(@PathVariable String key) throws UnsupportedEncodingException {
if (key == null) {
return ResponseEntity.notFound().build();
}
......@@ -189,7 +190,7 @@ public class WxStorageController {
ResponseEntity.notFound();
}
return ResponseEntity.ok().contentType(mediaType).header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"" + storage.getName() + "\"").body(file);
"attachment; filename=\"" + URLEncoder.encode(storage.getName(), "UTF-8") + "\"").body(file);
}
......
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