GeopJr / Tuba

[On break until 2024-07-15] Browse the Fediverse
https://tuba.geopjr.dev/
GNU General Public License v3.0
511 stars 55 forks source link

[Bug]: '%3' #1056

Closed xabirequejo closed 6 days ago

xabirequejo commented 1 week ago

Describe the bug

%3 seems to be some sort of modifier and it doesn't show when publishing messages using Tuba. Example:

Some %35 of the Earth is covered by soil.

Would be published as:

Some 5 of the Earth is covered by soil.

I have also tried Metatext, Feditext, Elk and IceCubes and they seem to work as expected.

Steps To Reproduce

  1. Compose a new post
  2. Include %3
  3. Send it

Logs and/or Screenshots

<paste your logs here>

Instance Backend

GoToSocial

Operating System

Fedora

Package

Flatpak

Troubleshooting information

No response

Additional Context

No response

GeopJr commented 1 week ago

Nice catch!

Turns out tootle would url decode websocket payloads for some reason :shrug: Anyway, your messages should still have the %3, it would just not show up to u if it showed up from the websocket (it would show up if u refreshed and it was included in the post!)

xabirequejo commented 1 week ago

I understood nothing but 👍

GeopJr commented 6 days ago

Longer explanation if you are interested (but feel free to skip if you aren't!)

The characters allowed in URLs are very limited. Mostly A-Z 0-9 and some symbols. But what happens if you want to have spaces, other special symbols or characters in different languages?

That's where URL Encodingwikipedia comes in. You can now represent those characters with 'percents'.

For example, here's what you see in the address bar vs what you actually copy:

Your browser converts them automatically, so either will work!

In your report, %35 became 5 because it was treated as a URL encoded string and Tuba tried to decode it. But it only did that on websocket messages.

Websockets are active connections that are kept alive. Tuba is connected to your instance, and when you published your post, your instance told Tuba 'hey here's a new post, add it to the timeline!'. And that's where Tuba would unnecessarily URL decode the whole post. Buttttt if you refreshed, Tuba would request the first 20 posts and since they weren't sent through the websocket, Tuba wouldn't mistakenly try to decode them, so %35 would stay as is!