Allow formatting parameters (?format=TEXT, ?format=JSON) on markdown files

When requesting a markdown file path via the auto command `+` (e.g.
`/repo/+/master/README.md?format=TEXT`), ViewFilter previously
unconditionally mapped all `.md` paths to `GitilesView.doc()`
(`DocServlet`). Because `DocServlet` only handles HTML rendering and
does not support TEXT (base64) or JSON representations, requesting
`format=TEXT` or `format=JSON` resulted in an HTTP 400
(UNSUPPORTED_RESPONSE_FORMAT) error.

This change updates `ViewFilter.parseAutoCommand` to check the requested
format. It only routes to `GitilesView.doc()` when the format is HTML or
DEFAULT (the standard web browser view). For TEXT or JSON requests, it
preserves `GitilesView.path()` so `PathServlet` serves the base64 or
JSON representation as expected, matching the behavior for non-markdown
files and the `+show` command.

Change-Id: Idd02ce77dba03bcc922983821ee3f55c37bfa878
3 files changed
tree: 7c2779aff261059f788d004c231a110fd9248df0
  1. .settings/
  2. Documentation/
  3. java/
  4. javatests/
  5. lib/
  6. modules/
  7. resources/
  8. tools/
  9. .bazelignore
  10. .bazelrc
  11. .bazelversion
  12. .gitignore
  13. .gitmodules
  14. .mailmap
  15. .zuul.yaml
  16. BUILD
  17. COPYING
  18. external_deps.lock.json
  19. fake_pom_deploy.xml
  20. MODULE.bazel
  21. MODULE.bazel.lock
  22. navbar.md
  23. README.md
  24. version.bzl
README.md

Gitiles - A simple JGit repository browser

Gitiles is a simple repository browser for Git repositories, built on JGit. Its guiding principle is simplicity: it has no formal access controls, no write access, no fancy Javascript, etc.

Gitiles automatically renders *.md Markdown files into HTML for simplified documentation. Refer to the Markdown documentation for details.

Configuration

Gitiles is configurable in a git-style configuration file named gitiles.config. Refer to the configuration documentation for details.

Bugs

Use gerrit's issue tracker to file bugs.

Contributing to Gitiles

Please refer to the Developer Guide.