FIX: permalinks redirect on subfolder installs could add the subfolder to the url twice

This commit is contained in:
Neil Lalonde
2015-10-12 16:48:32 -04:00
parent 1a3e9cf571
commit 3ef16a7711
3 changed files with 12 additions and 2 deletions

View File

@ -10,6 +10,16 @@ describe PermalinksController do
expect(response.status).to eq(301)
end
it "should work for subfolder installs too" do
GlobalSetting.stubs(:relative_url_root).returns('/forum')
Discourse.stubs(:base_uri).returns("/forum")
permalink = Fabricate(:permalink)
Permalink.any_instance.stubs(:target_url).returns('/forum/t/the-topic-slug/42')
get :show, url: permalink.url
expect(response).to redirect_to('/forum/t/the-topic-slug/42')
expect(response.status).to eq(301)
end
it "should apply normalizations" do
SiteSetting.permalink_normalizations = "/(.*)\\?.*/\\1"