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

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