Clippy
This commit is contained in:
@@ -623,16 +623,16 @@ async fn fetch_wikipedia_data(
|
||||
let cache_key = format!("artist_wiki:{mbid}");
|
||||
|
||||
// Check cache first
|
||||
if let Ok(Some(json)) = queries::cache::get(state.db.conn(), &cache_key).await {
|
||||
if let Ok(cached) = serde_json::from_str::<serde_json::Value>(&json) {
|
||||
return (
|
||||
cached
|
||||
.get("photo_url")
|
||||
.and_then(|v| v.as_str())
|
||||
.map(String::from),
|
||||
cached.get("bio").and_then(|v| v.as_str()).map(String::from),
|
||||
);
|
||||
}
|
||||
if let Ok(Some(json)) = queries::cache::get(state.db.conn(), &cache_key).await
|
||||
&& let Ok(cached) = serde_json::from_str::<serde_json::Value>(&json)
|
||||
{
|
||||
return (
|
||||
cached
|
||||
.get("photo_url")
|
||||
.and_then(|v| v.as_str())
|
||||
.map(String::from),
|
||||
cached.get("bio").and_then(|v| v.as_str()).map(String::from),
|
||||
);
|
||||
}
|
||||
|
||||
// Find Wikipedia URL from artist info — try direct link first, then resolve via Wikidata
|
||||
@@ -641,7 +641,7 @@ async fn fetch_wikipedia_data(
|
||||
Some(u.url.clone())
|
||||
} else if let Some(wd) = info.urls.iter().find(|u| u.link_type == "wikidata") {
|
||||
// Extract Wikidata entity ID and resolve to Wikipedia URL
|
||||
let entity_id = wd.url.split('/').last().unwrap_or("");
|
||||
let entity_id = wd.url.split('/').next_back().unwrap_or("");
|
||||
resolve_wikidata_to_wikipedia(entity_id).await
|
||||
} else {
|
||||
None
|
||||
|
||||
Reference in New Issue
Block a user