christianselig / apollo-bugs

A public bug tracker for Apollo, an iOS Reddit app
228 stars 15 forks source link

Incorrect preview URL for ccTLDs #1654

Open rfrowe opened 2 years ago

rfrowe commented 2 years ago

Describe the bug I viewed a post which linked to pravda.com.ua however the URL displayed shows only com.ua

To Reproduce Steps to reproduce the behavior:

  1. Go to a post which links to a .com.au URL
  2. See issue

iOS version: 15.3.1 Apollo version: 1.12.2 iOS device: iPhone X Jailbroken: Nope Reproducible: Yes

Expected behavior The link preview should display the full pravda.com.ua domain in the preview.

Screenshots image

Additional context I would imagine that what's happening here is URLs are parsed and subdomains are removed when generating the preview URL. This is incorrectly recognizing .ua as the TLD and com as the domain rather than .com.ua as the TLD and pravda as the domain

grischard commented 2 years ago

The behaviour for other TLDs is correct, for example https://reddit.com/r/worldnews/comments/thhvfq/russian_cosmonauts_wear_yellow_and_blue_when/

Apollo should use https://publicsuffix.org