core: reduce peak memory of conversion (single page-count scan, early input/stream release, streamed document.xml, eager raster flush); app: reject oversized upload before getBytes()
PR checks / web (pull_request) Successful in 35s
PR checks / java (pull_request) Successful in 1m11s
Main: tests, deploy, autotests / web (push) Successful in 41s
Main: tests, deploy, autotests / java (push) Successful in 1m16s
Main: tests, deploy, autotests / images-web (push) Successful in 28s
Main: tests, deploy, autotests / images-app (push) Successful in 39s
Main: tests, deploy, autotests / deploy (push) Failing after 4m59s
Main: tests, deploy, autotests / autotests (push) Has been skipped
Main: tests, deploy, autotests / rollback (push) Failing after 2m29s

This commit was merged in pull request #83.
This commit is contained in:
Pjandro
2026-11-01 03:44:35 +00:00
parent 230fe233c0
commit 07028d1509
7 changed files with 84 additions and 32 deletions
@@ -85,6 +85,15 @@ final class ConvertController {
// .doc (Word 97–2003) переносится в .docx мостом internal.doc
throw new ValidationException("Поддерживаются только .docx и .doc: " + name);
}
// Размер проверяется до getBytes(): multipart-лимит сервера (100 МБ)
// больше логического лимита входа (wordpdf.max-mb), и без этого гварда
// заведомо oversized-upload сначала материализовался бы в куче.
// Текст — тот же формат, что WordPdfValidator.checkInput.
long maxBytes = maxMb * 1024 * 1024;
if (file.getSize() > maxBytes) {
throw new ValidationException("Файл больше " + maxMb + " МБ: "
+ file.getSize() + " байт > " + maxBytes + " байт");
}
byte[] docxBytes;
try {
docxBytes = file.getBytes();