jpopesculian / twitter-v2-rs

Rust bindings for Twitter API v2
https://docs.rs/twitter-v2/latest
102 stars 28 forks source link

Allow empty string for profile image URL #22

Open Syfaro opened 1 year ago

Syfaro commented 1 year ago

This is a bit of a weird issue and I'm not entirely sure this is the best way to solve it. Essentially, some users have a profile_image_url that's an empty string, not null, and that obviously can't be deserialized to a url::Url. This adds a custom function for deserializing that converts empty strings to None, and continues to parse non-empty strings to a url::Url. I've loaded tens of thousands of profiles with these changes and it seems to fix the issue.

Syfaro commented 1 year ago

Making it generic was a good idea! And thanks for the pointer on where to put it.