pub fn resolve_request_path(
config: &PathResolverConfig<'_>,
request_path: &str,
) -> ResolvedPathExpand description
Resolves a URL path to determine what resource should be served.
This is a pure function that performs filesystem checks (through
config.vault) but no I/O operations like reading file contents. It
determines the type of resource to serve.
§Resolution Order
- Direct file match in base_dir → StaticFile
- Directory with configured index file (e.g., index.md) → MarkdownFile
- Path with trailing slash matching a markdown file (e.g., /foo/ → foo.md) → MarkdownFile
- File in static folder → StaticFile
- Directory with index.{markdown_ext} → MarkdownFile
- Directory without index → DirectoryListing
- Tag source index (e.g., /tags/) → TagSourceIndex (if source matches config)
- Tag page (e.g., /tags/rust/) → TagPage (if source matches config)
- Nothing matches → NotFound
Note: Filesystem paths (steps 1-6) always take precedence over tag URLs (steps 7-8). If a file or directory named “tags” exists, it will be served instead of the tag index.
§Security
Path traversal attacks (e.g., ../../../etc/passwd) are blocked by validating
that all resolved paths remain within the configured base directory.