Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always open index page with serve --open #1830

Merged
merged 1 commit into from
Jul 1, 2022
Merged

Conversation

ISSOtm
Copy link
Contributor

@ISSOtm ISSOtm commented Jun 22, 2022

This fixes an issue where mdbook serve --open may land on a 404 page if the file name is changed. This is easily reproduced by running mdbook serve --open guide on mdBook itself, which will open http://localhost:3000/README.html, which 404's thanks to the index preproc.

Since mdBook seems to always generate an index.html page for the first chapter anyway, it seems that "trimming the fat" is also more correct.

@ehuss
Copy link
Contributor

ehuss commented Jun 27, 2022

Thanks! This was intentionally changed in #1714 to avoid problems with draft chapters. Can you find a solution that fixes both issues?

@ISSOtm
Copy link
Contributor Author

ISSOtm commented Jun 27, 2022

I'd say this is fixed by #1829, which ensures that index.html is always generated, even if there are draft chapters before the first "real" one. (If there are no non-draft chapters, this will 404, but there's nothing to serve, anyway.)

@ehuss
Copy link
Contributor

ehuss commented Jun 30, 2022

Can you also update build.rs and watch.rs?

@ISSOtm
Copy link
Contributor Author

ISSOtm commented Jun 30, 2022

What needs to be changed?

@ehuss
Copy link
Contributor

ehuss commented Jun 30, 2022

They both have --open flags with code that needs to be updated. More or less, this should revert #1714.

@ISSOtm
Copy link
Contributor Author

ISSOtm commented Jul 1, 2022

Done!

Copy link
Contributor

@ehuss ehuss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ehuss ehuss merged commit 4c303c3 into rust-lang:master Jul 1, 2022
@ISSOtm ISSOtm deleted the serve branch July 1, 2022 20:20
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.

None yet

2 participants