dev fix download with cyrrilic symbols
Test Workflow / test (push) Has been cancelled

This commit is contained in:
2026-05-22 15:01:43 +07:00
parent 71e410aef5
commit 34d5f159a4
@@ -47,6 +47,7 @@ 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;
@@ -608,13 +609,13 @@ public class ApiController {
dockViewService.createDockView(viewerRequest, userId);
String filename = entityResponse.getFileName();
ContentDisposition contentDisposition = ContentDisposition.attachment()
.filename(filename, StandardCharsets.UTF_8)
.build();
String encodedFilename = URLEncoder.encode(filename, StandardCharsets.UTF_8)
.replace("+", "%20");
return ResponseEntity.ok()
.contentType(MediaType.APPLICATION_OCTET_STREAM)
.header(HttpHeaders.CONTENT_DISPOSITION, contentDisposition.toString())
.header(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename*=UTF-8''" + encodedFilename)
.body(bytes);
} catch (FileEntityNotFoundException e) {
Map<String, Object> errorData = new HashMap<>();