dev delete config
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-02-16 18:57:45 +07:00
parent 3c00a5bd2c
commit e05bf7ef3a
2 changed files with 7 additions and 3 deletions
@@ -17,6 +17,8 @@ import ru.soune.nocopy.repository.UserRepository;
import ru.soune.nocopy.service.file.CheckCounterService;
import ru.soune.nocopy.service.file.FileStorageService;
import org.springframework.http.ContentDisposition;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.io.IOException;
@@ -71,10 +73,14 @@ public class FileController {
throw new RuntimeException("File is not protected");
}
String fileName = fileEntity.getOriginalFileName();
String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8)
.replace("+", "%20");
return ResponseEntity.ok()
.contentType(new MediaType(fileEntity.getMimeType(), fileEntity.getFileExtension()))
.header(HttpHeaders.CONTENT_DISPOSITION,
"inline; filename=\"" + fileEntity.getOriginalFileName() + "\"")
"inline; filename*=UTF-8''" + encodedFileName)
.body(resource);
}