Skip to content

Commit ab42af5

Browse files
committed
Make sure, that the input url ends with a slash
1 parent 42b15ac commit ab42af5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,11 @@ fn validate_authentication(s: &str) -> Result<String, String> {
5050
}
5151

5252
fn build_sitemap_url(args: &Args, sitemap_name: &str) -> anyhow::Result<Url> {
53-
let base_url = Url::parse(&args.url).expect("Failed to parse base URL");
53+
let mut url_str = args.url.clone();
54+
if !url_str.ends_with('/') {
55+
url_str.push('/');
56+
}
57+
let base_url = Url::parse(&url_str).expect("Failed to parse base URL");
5458

5559
let mut full_url = base_url.join(sitemap_name).expect("Failed to join URL");
5660

0 commit comments

Comments
 (0)