mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-27 09:36:19 -05:00
FIX: link starting with '[poll' should not break polls
This commit is contained in:
parent
76a95e4aaf
commit
b8005f0b1b
2 changed files with 10 additions and 2 deletions
|
@ -8,10 +8,10 @@
|
|||
const WHITELISTED_ATTRIBUTES = ["type", "name", "min", "max", "step", "order", "color", "background", "status"];
|
||||
const WHITELISTED_STYLES = ["color", "background"];
|
||||
|
||||
const ATTRIBUTES_REGEX = new RegExp("(" + WHITELISTED_ATTRIBUTES.join("|") + ")=['\"]?[^\\s\\]=]+['\"]?", "g");
|
||||
const ATTRIBUTES_REGEX = new RegExp("(" + WHITELISTED_ATTRIBUTES.join("|") + ")=['\"]?[^\\s\\]]+['\"]?", "g");
|
||||
|
||||
Discourse.Dialect.replaceBlock({
|
||||
start: /\[poll([^\]]*)\]([\s\S]*)/igm,
|
||||
start: /\[poll((?:\s+\w+=[^\s\]]+)*)\]([\s\S]*)/igm,
|
||||
stop: /\[\/poll\]/igm,
|
||||
|
||||
emitter: function(blockContents, matches) {
|
||||
|
|
|
@ -57,6 +57,14 @@ describe PostsController do
|
|||
expect(json["polls"]["<script>alert(xss)</script>"]).to be
|
||||
end
|
||||
|
||||
it "also works whe there is a link starting with '[poll'" do
|
||||
xhr :post, :create, { title: title, raw: "[Polls are awesome](/foobar)\n[poll]\n- A\n- B\n[/poll]" }
|
||||
expect(response).to be_success
|
||||
json = ::JSON.parse(response.body)
|
||||
expect(json["cooked"]).to match("data-poll-")
|
||||
expect(json["polls"]).to be
|
||||
end
|
||||
|
||||
describe "edit window" do
|
||||
|
||||
describe "within the first 5 minutes" do
|
||||
|
|
Loading…
Reference in a new issue