The artifact index listed a report directory by its index page alone, so werkcrappit's mutation-crap.md beside PIT's index.html was archived but never listed. A .md file directly in a listed report directory, in reports/ or one of its sub-directories, now gets its own link. Spring knows no type for Markdown and sent it as a download; it is served as UTF-8 plain text now, like a log. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: mhoennig <michael@hoennig.de> Reviewed-on: #88
2.2 KiB
PR#88: Markdown Reports in the Artifact Index
This document describes the change of this pull request at the time it was made. Later pull requests may change the behaviour without updating it.
The Problem
The artifact index lists a report directory by its index page alone.
werkcrappit writes mutation-crap.md into PIT's report directory, next to PIT's index.html.
In hsadmin-ng's builds the file was archived but never listed; it could only be fetched by its path.
And opened by its path, a .md file came as application/octet-stream and the browser downloaded it, since Spring knows no type for Markdown.
Non-Goals
- Rendering Markdown as HTML.
- Listing other file types next to an index page, such as werkcrappit's
mutation-crap.json: it is for machines. - Listing files deeper inside a report; they belong to the report they lie in.
The Scenarios
Scenario#88.01: a Markdown report beside an index page is listed
- Given a build whose
reports/pitest/holds PIT'sindex.htmland werkcrappit'smutation-crap.md - When the artifact page of that build is shown
- Then it links
reports/pitest/index.htmlandreports/pitest/mutation-crap.md - And neither the JSON next to them nor a Markdown file deeper in the report
Verified by
Scenario#88.02: a Markdown report is shown, not downloaded
- When a
.mdartifact is requested - Then it is served as
text/plain;charset=UTF-8withContent-Disposition: inline
Verified by
The Solution
UiController.markdownReports adds the .md files lying directly in a listed report directory, in reports/ itself, or in one of its direct sub-directories.
It is the same depth the index-less report pages are searched at, so a report tree cannot flood the index.
ArtifactFileController serves md like log, as UTF-8 plain text; plain text, not text/markdown, because every browser shows plain text inline.