mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
correct spec and allow for zero allowed iframes
This commit is contained in:
parent
cb56dcdf2e
commit
46ebd0ee40
@ -62,7 +62,7 @@ export function buildOptions(state) {
|
||||
lookupImageUrls,
|
||||
censoredWords,
|
||||
allowedHrefSchemes: siteSettings.allowed_href_schemes ? siteSettings.allowed_href_schemes.split('|') : null,
|
||||
allowedIframes: (siteSettings.allowed_iframes || '').split('|'),
|
||||
allowedIframes: siteSettings.allowed_iframes ? siteSettings.allowed_iframes.split('|') : [],
|
||||
markdownIt: true,
|
||||
previewing
|
||||
};
|
||||
|
@ -4,7 +4,9 @@ import { hrefAllowed } from 'pretty-text/sanitizer';
|
||||
QUnit.module("lib:sanitizer");
|
||||
|
||||
QUnit.test("sanitize", assert => {
|
||||
const pt = new PrettyText(buildOptions({ siteSettings: {} }));
|
||||
const pt = new PrettyText(buildOptions({ siteSettings: {
|
||||
"allowed_iframes": 'https://www.google.com/maps/embed?|https://www.openstreetmap.org/export/embed.html?'
|
||||
} }));
|
||||
const cooked = (input, expected, text) => assert.equal(pt.cook(input), expected.replace(/\/>/g, ">"), text);
|
||||
|
||||
assert.equal(pt.sanitize("<i class=\"fa-bug fa-spin\">bug</i>"), "<i>bug</i>");
|
||||
@ -28,8 +30,8 @@ QUnit.test("sanitize", assert => {
|
||||
"<iframe src=\"https://www.google.com/maps/embed?pb=!1m10!1m8!1m3!1d2624.9983685732213!2d2.29432085!3d48.85824149999999!3m2!1i1024!2i768!4f13.1!5e0!3m2!1sen!2s!4v1385737436368\" width=\"100\" height=\"42\"></iframe>",
|
||||
"it allows iframe to google maps");
|
||||
|
||||
cooked("<iframe width=\"425\" height=\"350\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" src=\"http://www.openstreetmap.org/export/embed.html?bbox=22.49454975128174%2C51.220338322410775%2C22.523088455200195%2C51.23345342732931&layer=mapnik\"></iframe>",
|
||||
"<iframe width=\"425\" height=\"350\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" src=\"http://www.openstreetmap.org/export/embed.html?bbox=22.49454975128174%2C51.220338322410775%2C22.523088455200195%2C51.23345342732931&layer=mapnik\"></iframe>",
|
||||
cooked("<iframe width=\"425\" height=\"350\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" src=\"https://www.openstreetmap.org/export/embed.html?bbox=22.49454975128174%2C51.220338322410775%2C22.523088455200195%2C51.23345342732931&layer=mapnik\"></iframe>",
|
||||
"<iframe width=\"425\" height=\"350\" frameborder=\"0\" marginheight=\"0\" marginwidth=\"0\" src=\"https://www.openstreetmap.org/export/embed.html?bbox=22.49454975128174%2C51.220338322410775%2C22.523088455200195%2C51.23345342732931&layer=mapnik\"></iframe>",
|
||||
"it allows iframe to OpenStreetMap");
|
||||
|
||||
assert.equal(pt.sanitize("<textarea>hullo</textarea>"), "hullo");
|
||||
|
Loading…
Reference in New Issue
Block a user