Skip to content

Commit

Permalink
[Twitter] Don't warn if the card doesn't contain any image value at all
Browse files Browse the repository at this point in the history
  • Loading branch information
SpriteOvO committed Jul 3, 2024
1 parent 27a3859 commit d4b00f0
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/source/twitter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,11 +502,28 @@ fn parse_tweet(tweet: data::Tweet) -> Post {
}))
}
Some(_) => {
critical!("type of image card mismatched! tweet: {:?}", urls.major());
critical!(
"type of image card mismatched! tweet: {:?}, card kv: {:?}",
urls.major(),
card.legacy.binding_values
);
None
}
None => {
warn!("image key not found in card for tweet: {:?}", urls.major());
if card
.legacy
.binding_values
.iter()
.any(|kv| matches!(kv.value, data::TweetCardValue::Image { .. }))
{
let rustfmt_bug =
"expected image key not found in card, but the card contains image.";
warn!(
"{rustfmt_bug} tweet: {:?}, card kv: {:?}",
urls.major(),
card.legacy.binding_values
);
}
None
}
}
Expand Down

0 comments on commit d4b00f0

Please sign in to comment.