rust-lang / rust-lang/mdBook

Absolute path in SUMMARY.md causes panic!

Open
#2,559 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug
Dominant language
Rust
Stars
22.2k
Forks
1.9k
PR merge metrics
PR metrics pending

Description

Problem

I have the following SUMMARY.md:

- [Second](/tmp/second.md)

mdbook build and also mdbook serve panic:

thread 'main' panicked at /home/gabor/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/mdbook-0.4.45/src/book/book.rs:292:14:
Chapters are always inside a book: StripPrefixError(())
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

IMHO it should calmly report en error.

On the other hand, if I have this in the SUMMARY.md then it prints an error message about not being able to create the file without a panic!

- [Second](/second.md)
Version
mdbook v0.4.45

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue with mdbook build and mdbook serve using the absolute paths shown in SUMMARY.md, then inspect src/book/book.rs around line 292. Done means both commands report the invalid absolute path as an error without panicking.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.