This commit is contained in:
@@ -47,7 +47,6 @@ import ru.soune.nocopy.service.user.moderation.UserVerificationService;
|
||||
import ru.soune.nocopy.util.FileUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -609,13 +608,13 @@ public class ApiController {
|
||||
dockViewService.createDockView(viewerRequest, userId);
|
||||
|
||||
String filename = entityResponse.getFileName();
|
||||
String encodedFilename = URLEncoder.encode(filename, StandardCharsets.UTF_8)
|
||||
.replace("+", "%20");
|
||||
ContentDisposition contentDisposition = ContentDisposition.builder("attachment")
|
||||
.filename(filename, StandardCharsets.UTF_8)
|
||||
.build();
|
||||
|
||||
return ResponseEntity.ok()
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION,
|
||||
"attachment; filename*=UTF-8''" + encodedFilename)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition.toString())
|
||||
.body(bytes);
|
||||
} catch (FileEntityNotFoundException e) {
|
||||
Map<String, Object> errorData = new HashMap<>();
|
||||
|
||||
Reference in New Issue
Block a user