Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "monolith"
version = "2.8.3"
version = "2.9.0"
authors = [
"Sunshine <snshn@tutanota.com>",
"Mahdi Robatipoor <mahdi.robatipoor@gmail.com>",
Expand Down
18 changes: 12 additions & 6 deletions src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ pub fn retrieve_asset(
))
}
} else {
print_error_message(&format!("{} (not found)", &url), options);
print_error_message(&format!("{} (file not found)", &url), options);

// Provoke error
Err(client.get("").send().unwrap_err())
Expand All @@ -550,7 +550,7 @@ pub fn retrieve_asset(

if cache.is_some() && cache.as_ref().unwrap().contains_key(&cache_key) {
// URL is in cache, we get and return it
print_info_message(&format!("{} (from cache)", &url), options);
print_info_message(&format!("{} (from cache)", &cache_key), options);

Ok((
cache.as_ref().unwrap().get(&cache_key).unwrap().0.to_vec(),
Expand Down Expand Up @@ -591,7 +591,10 @@ pub fn retrieve_asset(
match client.get(url.as_str()).headers(headers).send() {
Ok(response) => {
if !options.ignore_errors && response.status() != reqwest::StatusCode::OK {
print_error_message(&format!("{} ({})", &url, response.status()), options);
print_error_message(
&format!("{} ({})", &cache_key, response.status()),
options,
);

// Provoke error
return Err(client.get("").send().unwrap_err());
Expand All @@ -600,9 +603,12 @@ pub fn retrieve_asset(
let response_url: Url = response.url().clone();

if url.as_str() == response_url.as_str() {
print_info_message(&format!("{}", &url), options);
print_info_message(&cache_key.to_string(), options);
} else {
print_info_message(&format!("{} -> {}", &url, &response_url), options);
print_info_message(
&format!("{} -> {}", &cache_key, &response_url),
options,
);
}

let new_cache_key: String = clean_url(response_url.clone()).to_string();
Expand Down Expand Up @@ -641,7 +647,7 @@ pub fn retrieve_asset(
Ok((data, response_url, media_type, charset))
}
Err(error) => {
print_error_message(&format!("{} ({})", &url, error), options);
print_error_message(&format!("{} ({})", &cache_key, error), options);

Err(client.get("").send().unwrap_err())
}
Expand Down
4 changes: 2 additions & 2 deletions tests/cli/local_files.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ mod passing {
"\
{file}{cwd}/tests/_data_/basic/local-file.html\n\
{file}{cwd}/tests/_data_/basic/local-style.css\n\
{file}{cwd}/tests/_data_/basic/local-style-does-not-exist.css (not found)\n\
{file}{cwd}/tests/_data_/basic/monolith.png (not found)\n\
{file}{cwd}/tests/_data_/basic/local-style-does-not-exist.css (file not found)\n\
{file}{cwd}/tests/_data_/basic/monolith.png (file not found)\n\
{file}{cwd}/tests/_data_/basic/local-script.js\n\
",
file = file_url_protocol,
Expand Down