mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 07:53:49 +08:00
FIX: path whitelist for embedded comments didn't work with non-ASCII chars
This commit is contained in:
@ -103,6 +103,22 @@ describe EmbeddableHost do
|
||||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com/rick/smith')).to eq(true)
|
||||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com/morty/sanchez')).to eq(true)
|
||||
end
|
||||
|
||||
it "works with non-english paths" do
|
||||
Fabricate(:embeddable_host, path_whitelist: '/انگلیسی/.*')
|
||||
Fabricate(:embeddable_host, path_whitelist: '/definição/.*')
|
||||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com/انگلیسی/foo')).to eq(true)
|
||||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com/definição/foo')).to eq(true)
|
||||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com/bar/foo')).to eq(false)
|
||||
end
|
||||
|
||||
it "works with URL encoded paths" do
|
||||
Fabricate(:embeddable_host, path_whitelist: '/definição/.*')
|
||||
Fabricate(:embeddable_host, path_whitelist: '/ingl%C3%A9s/.*')
|
||||
|
||||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com/defini%C3%A7%C3%A3o/foo')).to eq(true)
|
||||
expect(EmbeddableHost.url_allowed?('http://eviltrout.com/inglés/foo')).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user