Xyphyn / photon

A replacement for lemmy-ui with more features, a better design, and more customizability.
https://phtn.app
GNU Affero General Public License v3.0
348 stars 39 forks source link

Bug: Lemmy link detection false positives #393

Open sevonj opened 1 month ago

sevonj commented 1 month ago

Describe the bug I saw this link in someone's post: https://www.youtube.com/c/TechnologyConnections. You know where this is going. Photon thinks it's a lemmy link and breaks it. I guess /c/, /u/, /post/, and /comment/ are relatively common on the internet.

To Reproduce (if applicable) Steps to reproduce the behavior:

Expected behavior Don't open these inside photon. The scope for users and communities could be limited by checking for proper link syntax around the url, along with exclamation point or at sign: [!___](/c/-link) and [@___](/u/-link).

Screenshots -

Versions

Xyphyn commented 1 month ago

But this breaks when people, in their infinite wisdom (/s) use a c/community link instead of anything else. lemmy-ui handles this afaik, so i should handle it in photon.

Xyphyn commented 1 month ago

Also, weren't c/ links retired on youtube? i thought they were replaced by youtube.com/@handle

sevonj commented 1 month ago

I don't know what YT's plan is, but apparently these links are still being used. There are probably a lot more other sites that use similar urls, too.

[!community](url) type links are the most common and accurately detectable. The user also has an excuse, because lemmy-ui automatically makes it that way. In pasting the url, none of that is true.

So, I guess it's priorities: want to break some correct links to fix lemmy user error?

Another thing: https://www.youtube.com/c/TechnologyConnections/videos turns into https://phtn.app/c/TechnologyConnections/videos@www.youtube.com. I'm pretty sure the only valid thing that can come after the community name is query strings. This could be handled by removing them, moving to the end, or not expecting anything after the actor name. A fix for this shouldn't break anything at all.

Xyphyn commented 1 month ago

I'll try and fix this soon