mirror of
https://github.com/discourse/discourse.git
synced 2025-09-05 08:59:27 +08:00
FIX: path whitelist for embedded comments didn't work with non-ASCII chars
This commit is contained in:
parent
e30851e45a
commit
a7c1b0c81f
2 changed files with 24 additions and 3 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue