From 45739e8b09a772a27d35b6c4b51c62503776a9ec Mon Sep 17 00:00:00 2001 From: Reilly Wood Date: Sat, 21 Dec 2024 12:27:49 -0800 Subject: [PATCH] Handle empty image URL, include stack traces with Sentry --- src/bluesky.rs | 2 +- src/main.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bluesky.rs b/src/bluesky.rs index f404f28..99c88be 100644 --- a/src/bluesky.rs +++ b/src/bluesky.rs @@ -30,7 +30,7 @@ pub async fn post_to_bluesky( if let Some(img_url) = &project.attributes.image_url { // sometimes they post generic images that we don't want to repost - if !img_url.to_lowercase().contains("generic") { + if !img_url.trim().is_empty() && !img_url.to_lowercase().contains("generic") { let img_bytes = reqwest::get(img_url).await?.bytes().await?; eprintln!("Downloaded image: {}", img_url); diff --git a/src/main.rs b/src/main.rs index cb4a7c0..613f48f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -62,6 +62,7 @@ fn main() -> Result<()> { "https://b9aa3a714ea10fe4c30c0905fbc8db11@sentry-intake.datadoghq.com/1", sentry::ClientOptions { release: sentry::release_name!(), + attach_stacktrace: true, ..Default::default() }, ));