olafmoriarty / blue-bots-done-quick

A version of Cheap Bots, Done Quick written for Bluesky
Apache License 2.0
13 stars 1 forks source link

img tags not parsing sometimes #5

Closed fawfulthegreat closed 3 weeks ago

fawfulthegreat commented 1 month ago

I ported a bot that i already had on Twitter using the same code (so I know for sure there were no mistakes in it), and it just made a post where one of the 4 images failed to display and instead showed the raw code for that one. I've verified the image in question is still up at the URL used. The post before that also did not attach an image that was supposed to be attached. https://bsky.app/profile/marioanything.bsky.social/post/3l6trq7hnev2u https://bsky.app/profile/marioanything.bsky.social/post/3l6tr6bdhye2w

(for reference every character that the bot names also pulls an image, so there should be an image for Baby Daisy in the second one too)

olafmoriarty commented 1 month ago

Thanks for the report. There are (at least) two different issues here.

The Goombario issue is that the character after "img" in {img https://i.imgur.com/TeCs1by.jpg} is not a normal space, but a non-breaking space, and the regex only checks for normal spaces. (I checked your code, and that's the case for two of your characters - Goombario and Bobby). I hadn't predicted that anyone would use a non-breaking space there and therefore didn't add it to the regular expression. I have no idea why CBDQ would support this as it doesn't make much sense to me, but it's an easy fix, so I'll add support for non-breaking spaces in image tags later today.

As for why the Baby Daisy image doesn't load, I haven't figured that out yet. My first assumption was that the image for some reason could not be uploaded to Bluesky, but that does not appear to be the case, so I'll look further into the issue and see what I can find out.

fawfulthegreat commented 1 month ago

It just happened with Fun Gus too. While Baby Daisy has worked on other occasions. I hope it's not just a random chance it fails to load an image.

olafmoriarty commented 3 weeks ago

The problem appears to not happen anymore, so I'll make the assumption that the cause was a temporary hiccup in Bluesky and close this issue now. Thanks for reporting it.