FedStoa / moa

A Mastodon, Twitter, and Instagram Cross-poster
https://moa.party
MIT License
355 stars 19 forks source link

Twitter’s URL shortening doesn’t seem to be taken into account when splitting toots #136

Closed ticky closed 4 years ago

ticky commented 4 years ago

I just composed a long toot which by my calculations should’ve split cleanly into two parts when posted to Twitter, but it resulted in three posts instead: https://twitter.com/ticky/status/1240359490551025665, https://twitter.com/ticky/status/1240359491222138882 and https://twitter.com/ticky/status/1240359491859705856.

The first tweet has 54 characters remaining according to Tweetbot, and I believe this discrepancy comes down to how the link’s length is being counted.

subins2000 commented 4 years ago

Yes, this makes the last tweet very small in length and that's an annoyance when it could've been easily included with the second-last tweet.

ticky commented 4 years ago

This keeps happening: https://cybre.space/@ticky/104095780393670500

https://twitter.com/ticky/status/1256365268814622722 / https://twitter.com/ticky/status/1256365269426925568

image

There’s 72 characters left over if this toot isn’t split when posting it to Twitter!

foozmeat commented 4 years ago

There may be an issue where link length isn't being adjusted for twitter's link shortener. I'll try to look into this soon.

foozmeat commented 4 years ago

The problem here was that the regex I was using for picking out URLs would return an incomplete match and so the length of the text wasn't decreased as much as it should have been. I've got a better URL regex now and my tests shows your previous toots would post the way you expect. If it happens again please let me know.

ticky commented 4 years ago

Thank you for this fix, I really appreciate it!