From a1fb9b1a8df66ace56b460e7137b270c590e22a2 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sat, 7 Mar 2026 08:12:06 +0700 Subject: [PATCH 1/2] Fix webgen panicking --- src/web/html.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/web/html.rs b/src/web/html.rs index 997d44efb..7b8b92f73 100644 --- a/src/web/html.rs +++ b/src/web/html.rs @@ -61,7 +61,7 @@ pub fn generate_html_pkg( Some(SourceRecipe::Git { git, .. }) => { let host = get_hostname(git); let tree_link = get_tree_url(git, host, &package.source_identifier, None); - let short_commit = &package.source_identifier[0..7]; + let short_commit = get_short_commit(&package.source_identifier); format!( r#" @@ -110,7 +110,7 @@ pub fn generate_html_pkg( &package.commit_identifier, Some(&format!("recipes/{category}/{name}/recipe.toml")), ); - let short_commit = &package.commit_identifier[0..7]; + let short_commit = get_short_commit(&package.commit_identifier); source_html += &format!( r#"
@@ -275,7 +275,7 @@ pub fn generate_html_index( target = redoxer::target(), category_sections = categories_html.join("\n\n"), commit_time = &ident::get_ident().time, - commit_hash = &ident::get_ident().commit[0..7], + commit_hash = get_short_commit(&ident::get_ident().commit), commit_tree = get_tree_url( &config.this_repo, get_hostname(&config.this_repo), @@ -324,3 +324,7 @@ pub fn get_tree_url(git_url: &str, host: &str, commit: &str, folder: Option<&str None => base_url, } } + +fn get_short_commit(commit: &str) -> &str { + commit.get(0..7).unwrap_or("?") +} From b7eebe7576bd3d48fc2cda9dddb03da629f7a414 Mon Sep 17 00:00:00 2001 From: Wildan M Date: Sat, 7 Mar 2026 08:12:33 +0700 Subject: [PATCH 2/2] Improve repo web message --- src/bin/repo_builder.rs | 1 + src/web/html.rs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bin/repo_builder.rs b/src/bin/repo_builder.rs index aca991ac9..5264a6e44 100644 --- a/src/bin/repo_builder.rs +++ b/src/bin/repo_builder.rs @@ -283,6 +283,7 @@ fn publish_packages(config: &CliConfig) -> anyhow::Result<()> { output_file.write_all(output.as_bytes())?; if let Some(conf) = &config.web { + eprintln!("\x1b[01;38;5;155mrepo - generating web content\x1b[0m"); generate_web(&repository.packages.keys().cloned().collect(), conf); } Ok(()) diff --git a/src/web/html.rs b/src/web/html.rs index 7b8b92f73..1f4d405eb 100644 --- a/src/web/html.rs +++ b/src/web/html.rs @@ -284,7 +284,6 @@ pub fn generate_html_index( ), ); - println!("Generating web content to {}", index_path.display()); fs::write(index_path, html).expect("Failed to write index HTML file"); }