1
0
Fork 1
Spiegel von https://github.com/dani-garcia/vaultwarden.git synchronisiert 2024-07-02 12:14:41 +02:00

Fixed issue when the iconlist is smaller then 5

When the iconlist was smaller then 5 items, it would cause a panic.
Solved by using .truncate() on the iconlist.
Dieser Commit ist enthalten in:
BlackDex 2019-02-04 17:27:40 +01:00
Ursprung 574b040142
Commit 9026cc8d42

Datei anzeigen

@ -296,9 +296,9 @@ fn download_icon(domain: &str) -> Result<Vec<u8>, Error> {
let mut buffer = Vec::new();
let mut attempts = 0;
while attempts < 5 {
let url = &iconlist.remove(0).href;
iconlist.truncate(5);
for icon in iconlist {
let url = icon.href;
info!("Downloading icon for {} via {}...", domain, url);
match get_page_with_cookies(&url, &cookie_str) {
Ok(mut res) => {
@ -308,7 +308,6 @@ fn download_icon(domain: &str) -> Result<Vec<u8>, Error> {
},
Err(_) => info!("Download failed for {}", url),
};
attempts += 1;
}
if buffer.is_empty() {