From 9ca9fe729adc1fa04fc03c808c67e267d0a25d58 Mon Sep 17 00:00:00 2001 From: Nick Ivanter Date: Mon, 4 Apr 2016 01:39:12 +0300 Subject: [PATCH] FIX: internal links in subfolder installs https://meta.discourse.org/t/links-arent-showing-in-the-sidebar-or-topic-summaries-on-subfolder-installs/41787/15 --- app/models/topic_link.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/models/topic_link.rb b/app/models/topic_link.rb index 98eefbcd8..aafaff14b 100644 --- a/app/models/topic_link.rb +++ b/app/models/topic_link.rb @@ -123,9 +123,11 @@ class TopicLink < ActiveRecord::Base if Discourse.store.has_been_uploaded?(url) internal = Discourse.store.internal? - elsif parsed.host == Discourse.current_hostname || !parsed.host + elsif (parsed.host == Discourse.current_hostname && parsed.path.start_with?(Discourse.base_uri)) || !parsed.host internal = true + parsed.path.slice!(Discourse.base_uri) + route = Rails.application.routes.recognize_path(parsed.path) # We aren't interested in tracking internal links to users