InstanceStaticPlug: Add more override and fallback tests
This commit is contained in:
parent
85a0f2e602
commit
1d6664b1f4
1 changed files with 22 additions and 0 deletions
|
|
@ -61,6 +61,28 @@ defmodule Pleroma.Web.Plugs.InstanceStaticTest do
|
||||||
File.write!(@dir <> "/static/kaniini.html", "<h1>rabbit hugs as a service</h1>")
|
File.write!(@dir <> "/static/kaniini.html", "<h1>rabbit hugs as a service</h1>")
|
||||||
index = get(build_conn(), "/static/kaniini.html")
|
index = get(build_conn(), "/static/kaniini.html")
|
||||||
assert html_response(index, 200) == "<h1>rabbit hugs as a service</h1>"
|
assert html_response(index, 200) == "<h1>rabbit hugs as a service</h1>"
|
||||||
|
|
||||||
|
File.write!(@dir <> "/static/kaniini the bnuuy.html", "<h1>rabbit hugs as a service</h1>")
|
||||||
|
index = get(build_conn(), "/static/kaniini%20the%20bnuuy.html")
|
||||||
|
assert html_response(index, 200) == "<h1>rabbit hugs as a service</h1>"
|
||||||
|
end
|
||||||
|
|
||||||
|
test "overrides /static/styles files with spaces in URL" do
|
||||||
|
Pleroma.Backports.mkdir_p!(@dir <> "/static/styles")
|
||||||
|
File.write(@dir <> "/static/styles/Redmond DX.iss", "overridden")
|
||||||
|
|
||||||
|
index = get(build_conn(), "/static/styles/Redmond%20DX.iss")
|
||||||
|
assert index.status == 200
|
||||||
|
assert index.resp_body == File.read!(@dir <> "/static/styles/Redmond DX.iss")
|
||||||
|
assert index.halted == true
|
||||||
|
end
|
||||||
|
|
||||||
|
test "serves fallback /static/styles files with spaces in URL" do
|
||||||
|
index = get(build_conn(), "/static/styles/Redmond%20DX.iss")
|
||||||
|
|
||||||
|
assert index.status == 200
|
||||||
|
assert index.resp_body == File.read!("priv/static/static/styles/Redmond DX.iss")
|
||||||
|
assert index.halted == true
|
||||||
end
|
end
|
||||||
|
|
||||||
test "does not sanitize dangerous files in general, as there can be html and javascript files legitimately in this folder" do
|
test "does not sanitize dangerous files in general, as there can be html and javascript files legitimately in this folder" do
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue