Skip to content

Commit

Permalink
Handle empty image URL, include stack traces with Sentry
Browse files Browse the repository at this point in the history
  • Loading branch information
rgwood committed Dec 21, 2024
1 parent b42cdbc commit 45739e8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/bluesky.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ fn main() -> Result<()> {
"https://[email protected]/1",
sentry::ClientOptions {
release: sentry::release_name!(),
attach_stacktrace: true,
..Default::default()
},
));
Expand Down

0 comments on commit 45739e8

Please sign in to comment.