diff options
| author | littleblack111 <littleblack11111@gmail.com> | 2026-08-04 21:29:39 +0800 |
|---|---|---|
| committer | littleblack111 <littleblack11111@gmail.com> | 2026-08-04 23:29:40 +0800 |
| commit | 605794a9efa52df7a20a377d3448dc078bda5529 (patch) | |
| tree | 0eebe291a391a74e07f5818f045e2351e5bd6715 /qml_plugin/src | |
| parent | 390aa8de50e36d69027c87d1670f5b73369526af (diff) | |
duckduckgo: remove invalid images
Diffstat (limited to 'qml_plugin/src')
| -rw-r--r-- | qml_plugin/src/web/duckduckgo.rs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/qml_plugin/src/web/duckduckgo.rs b/qml_plugin/src/web/duckduckgo.rs index 6de39af..b87d5af 100644 --- a/qml_plugin/src/web/duckduckgo.rs +++ b/qml_plugin/src/web/duckduckgo.rs @@ -145,7 +145,15 @@ pub async fn query(input: &str) -> anyhow::Result<DuckDuckGoContent> { // TODO: try also Results[*].Icon.URL and RelatedTopics[*].Icon.URL image: resp .image - .and_then(|i| Url::parse(&format!("{DUCKDUCKGO}{i}",)).ok()), + .and_then( + |i| { + if !i.is_empty() { + Url::parse(&format!("{DUCKDUCKGO}{i}",)).ok() + } else { + None + } + }, + ), }, ) } |
