Skip to content

fix: fall back to literal path on path-extension 406#24479

Merged
netroms merged 1 commit into
masterfrom
fix/path-extension-media-type-fallback
Jul 20, 2026
Merged

fix: fall back to literal path on path-extension 406#24479
netroms merged 1 commit into
masterfrom
fix/path-extension-media-type-fallback

Conversation

@netroms

@netroms netroms commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Follow-up to chore: reinstate path-extension content negotiation without Spring 7 flags #24463 (PR-F content negotiation).
  • Analytics download endpoints that map both a JSON produces handler and a literal-suffix download path (e.g. /query/{id}.xml) started returning 406 after PR-F.
  • Root cause: stripped-path lookup matches the JSON handler, forces application/xml via the suffix strategy, throws HttpMediaTypeNotAcceptableException, and never falls back to the literal mapping.
  • Fix: catch that 406 on the stripped lookup and retry the original path; rethrow only when no literal fallback exists.

Why this surfaced now

Jason's Doris analytics PR #24440 CI failed on master HEAD with 12 e2e download tests (xml/csv/xls/xlsx). Not caused by that PR — master regression from #24463.

Test plan

  • CustomRequestMappingHandlerMappingNormalizeTest (13 tests, including new regression for analytics-style dual mappings)
  • CI analytics e2e downloads (TrackedEntity/Enrollments/Events Aggregate/Query)

Notes

  • No controller changes required.
  • Pattern fixed generically for any dual JSON+literal-suffix endpoint.

After #24463, suffix-stripped lookup could match a JSON produces handler
and throw HttpMediaTypeNotAcceptableException before the literal-suffix
download mapping ran. Catch that 406 and retry the original path so
analytics .xml/.csv/.xls/.xlsx downloads work again.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue
1 New Code Smells (required ≤ 0)

See analysis details on SonarQube Cloud

💡 Need a hand with PR review? Try Gitar by Sonar!

@netroms
netroms merged commit ec12922 into master Jul 20, 2026
22 of 23 checks passed
@netroms
netroms deleted the fix/path-extension-media-type-fallback branch July 20, 2026 09:27
jason-p-pickering pushed a commit that referenced this pull request Jul 23, 2026
Follow-up to #24479. Paths like /api/analytics.xlsx/ fully strip to
/api/analytics, hit the JSON produces handler (406), then failed the
literal fallback because the original URI still had the trailing slash
and Spring 7 does not trailing-slash-match.

Retry with only the trailing slash removed before the raw original path
so literal download mappings still win. Covers the RestAssured basePath
pattern used by AnalyticsAggregateDownloadTest.
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.

3 participants