Skip to content

Commit

Permalink
URLs should not be pathbufs
Browse files Browse the repository at this point in the history
  • Loading branch information
Coi-l committed Mar 30, 2024
1 parent cc679ca commit fea273e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/cmd/shelf.rs
Expand Up @@ -68,7 +68,7 @@ fn update_index(
Ok(())
}

fn process_book(path: &str, books_dir: &PathBuf, shelf_url: &PathBuf) -> Result<BookContext> {
fn process_book(path: &str, books_dir: &PathBuf, shelf_url: &str) -> Result<BookContext> {
let book_dir = path.try_resolve()?;
let book_dir = std::fs::canonicalize(book_dir)?;
let mut book = MDBook::load(book_dir)?;
Expand Down Expand Up @@ -112,9 +112,8 @@ pub fn execute(_args: &ArgMatches) -> Result<()> {
} else {
"".to_owned()
};
let shelf_url = PathBuf::from(format!(
"{shelf_url_prefix}/{shelf_book_dir}/{shelf_build_dir}/{INDEX_HTML_FILE}"
));
let shelf_url =
format!("{shelf_url_prefix}/{shelf_book_dir}/{shelf_build_dir}/{INDEX_HTML_FILE}");

let mut index_file_name = shelf_book.source_dir();
index_file_name.push(INDEX_MD_FILE);
Expand Down
2 changes: 1 addition & 1 deletion src/config.rs
Expand Up @@ -416,7 +416,7 @@ pub struct BookConfig {
pub text_direction: Option<TextDirection>,
/// Indicates if the book is part of a bookshelf
/// and how to return to the index of the shelf if so
pub shelf_url: Option<PathBuf>,
pub shelf_url: Option<String>,
}

impl Default for BookConfig {
Expand Down

0 comments on commit fea273e

Please sign in to comment.