Skip to content

Print languages: backend-neutral codes from the CMS, malformed Accept-Language degrades instead of throwing - #6969

Merged
delchev merged 1 commit into
masterfrom
fix-s3-print-language-slash
Aug 27, 2026
Merged

Print languages: backend-neutral codes from the CMS, malformed Accept-Language degrades instead of throwing#6969
delchev merged 1 commit into
masterfrom
fix-s3-print-language-slash

Conversation

@delchev

@delchev delchev commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Fixes #6967 — two halves, both needed:

  1. CmsStore.listLanguages strips the trailing path separator the S3 CMS keeps on child folder names (CmisS3Folder.getName()en/), so GET /services/print/{entity}/languages serves the same clean codes on every CMS backend.
  2. UserFacade.getLanguage catches IllegalArgumentException from Locale.LanguageRange.parse — the header is client-controlled, and a malformed value must degrade to "no language preference" (warn + empty) rather than turn every localized repository read on the request into a 500.

Observed in production-shaped staging (S3 CMS, 14.36.0): Print → any language → SalesInvoicePrintFeeder#feed threw: range=en/.

🤖 Generated with Claude Code

…Accept-Language degrades instead of throwing

The S3 CMS names child folders with their trailing separator (en/), so
CmsStore.listLanguages served slash-suffixed language codes; the print
dialog offered them and pinned the pick as Accept-Language, and
Locale.LanguageRange.parse("en/") then threw out of
UserFacade.getLanguage - every localized repository read in the print
feeder answered 500 on S3-backed deployments.

CmsStore now strips the separator so the language CODE contract does not
depend on the CMS backend, and UserFacade.getLanguage treats a malformed
client-controlled header as "no preference" (warn + empty) instead of
propagating IllegalArgumentException.

Fixes #6967

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
// The header is client-controlled: a malformed value must degrade to "no language
// preference", never turn every localized read on this request into a 500.
if (logger.isWarnEnabled()) {
logger.warn("Malformed Accept-Language header [{}] - ignoring it", language);
@delchev
delchev merged commit 9323dc3 into master Aug 27, 2026
10 checks passed
@delchev
delchev deleted the fix-s3-print-language-slash branch August 27, 2026 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

S3 CMS lists print-template language folders with a trailing slash, crashing every localized read in the print flow

2 participants