|
@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
import java.io.*;
|
|
|
+import java.net.URLEncoder;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
@@ -236,7 +237,6 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
|
|
|
|
|
|
public static void outputFile(HttpServletResponse response, File file, String fileName) {
|
|
|
try {
|
|
|
-
|
|
|
if (!file.exists()) {
|
|
|
response.sendError(404, "File not found!");
|
|
|
}
|
|
@@ -245,7 +245,7 @@ public class AttachmentCommonServiceImpl implements AttachmentCommonService {
|
|
|
byte[] buf = new byte[1024];
|
|
|
int len = 0;
|
|
|
|
|
|
- String fName = new String(fileName.getBytes(), StandardCharsets.UTF_8);
|
|
|
+ String fName = URLEncoder.encode(fileName, "UTF-8");
|
|
|
|
|
|
response.reset();
|
|
|
response.setContentType("application/x-msdownload");
|