`Topic#featured_link` containing more than just a valid URL

  1. Create topic and paste https://meta.discourse.org test into title
  2. Topic.last.featured_link returns https://meta.discourse.org test.

@neil Can I confirm that the featured link feature is only activated when the title is a valid link only?

1 Like

Are you sure https://meta.discourse.org test is not interpreted as https://meta.discourse.org%20test or https://meta.discourse.org+test?

Nope Topic#featured_link gets stored as whatever the title is

[6] pry(main)> Topic.last.featured_link
  Topic Load (0.8ms)  SELECT  "topics".* FROM "topics" WHERE ("topics"."deleted_at" IS NULL) ORDER BY "topics"."id" DESC LIMIT 1
=> "https://meta.discourse.org yay"

I mean maybe https://meta.discourse.org yay is a valid URL which is interpreted as https://meta.discourse.org%20yay.

EDIT: Type in https://meta.discourse.org%20yay into FireFox and it gets turned back into https://meta.discourse.org yay for display.

In Chrome, of course, it bounces straight to search via detecting two separate words for the domain name, meaning that Chrome doesn’t like spaces in domain names, but FireFox does.

It was a bug. It should not have turned the title into a featured link if it had something other than a url in it.

https://github.com/discourse/discourse/commit/cde42c3f69dfb4e1b81bf48370ee54644e1be2d2

5 Likes