DEV: Remove xlink hrefs (#15059)
This commit is contained in:
parent
09260148b1
commit
4c46c7e334
|
@ -149,7 +149,7 @@ registerIconRenderer({
|
|||
if (params.label) {
|
||||
html += " aria-hidden='true'";
|
||||
}
|
||||
html += ` xmlns="${SVG_NAMESPACE}"><use xlink:href="#${id}" /></svg>`;
|
||||
html += ` xmlns="${SVG_NAMESPACE}"><use href="#${id}" /></svg>`;
|
||||
if (params.label) {
|
||||
html += `<span class='sr-only'>${escape(params.label)}</span>`;
|
||||
}
|
||||
|
@ -178,10 +178,7 @@ registerIconRenderer({
|
|||
},
|
||||
[
|
||||
h("use", {
|
||||
"xlink:href": attributeHook(
|
||||
"http://www.w3.org/1999/xlink",
|
||||
`#${escape(id)}`
|
||||
),
|
||||
href: attributeHook("http://www.w3.org/1999/xlink", `#${escape(id)}`),
|
||||
namespace: SVG_NAMESPACE,
|
||||
}),
|
||||
]
|
||||
|
|
|
@ -234,7 +234,7 @@ class PluginApi {
|
|||
*
|
||||
* // for the place in code that render a string
|
||||
* string() {
|
||||
* return "<svg class=\"fa d-icon d-icon-far-smile svg-icon\" aria-hidden=\"true\"><use xlink:href=\"#far-smile\"></use></svg>";
|
||||
* return "<svg class=\"fa d-icon d-icon-far-smile svg-icon\" aria-hidden=\"true\"><use href=\"#far-smile\"></use></svg>";
|
||||
* },
|
||||
*
|
||||
* // for the places in code that render virtual dom elements
|
||||
|
@ -244,7 +244,7 @@ class PluginApi {
|
|||
* namespace: "http://www.w3.org/2000/svg"
|
||||
* },[
|
||||
* h("use", {
|
||||
* "xlink:href": attributeHook("http://www.w3.org/1999/xlink", `#far-smile`),
|
||||
* "href": attributeHook("http://www.w3.org/1999/xlink", `#far-smile`),
|
||||
* namespace: "http://www.w3.org/2000/svg"
|
||||
* })]
|
||||
* );
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{{#each buttons as |b|}}
|
||||
<button type="button" class="btn btn-social {{b.name}}" {{action externalLogin b}} aria-label={{b.screenReaderTitle}} tabindex="3">
|
||||
{{#if b.isGoogle}}
|
||||
<svg class="fa d-icon d-icon-custom-google-oauth2 svg-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 48 48"><defs><path id="a" d="M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z"/></defs><clipPath id="b"><use xlink:href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FBBC05" d="M0 37V11l17 13z"/><path clip-path="url(#b)" fill="#EA4335" d="M0 11l17 13 7-6.1L48 14V0H0z"/><path clip-path="url(#b)" fill="#34A853" d="M0 37l30-23 7.9 1L48 0v48H0z"/><path clip-path="url(#b)" fill="#4285F4" d="M48 48L17 24l-4-3 35-10z"/></svg>
|
||||
<svg class="fa d-icon d-icon-custom-google-oauth2 svg-icon" viewBox="0 0 48 48"><defs><path id="a" d="M44.5 20H24v8.5h11.8C34.7 33.9 30.1 37 24 37c-7.2 0-13-5.8-13-13s5.8-13 13-13c3.1 0 5.9 1.1 8.1 2.9l6.4-6.4C34.6 4.1 29.6 2 24 2 11.8 2 2 11.8 2 24s9.8 22 22 22c11 0 21-8 21-22 0-1.3-.2-2.7-.5-4z"/></defs><clipPath id="b"><use href="#a" overflow="visible"/></clipPath><path clip-path="url(#b)" fill="#FBBC05" d="M0 37V11l17 13z"/><path clip-path="url(#b)" fill="#EA4335" d="M0 11l17 13 7-6.1L48 14V0H0z"/><path clip-path="url(#b)" fill="#34A853" d="M0 37l30-23 7.9 1L48 0v48H0z"/><path clip-path="url(#b)" fill="#4285F4" d="M48 48L17 24l-4-3 35-10z"/></svg>
|
||||
{{else if b.icon}}
|
||||
{{d-icon b.icon}}
|
||||
{{else}}
|
||||
|
|
|
@ -62,7 +62,7 @@ acceptance("Bookmarking", function (needs) {
|
|||
topicResponse.post_stream.posts[0].cooked += `<span data-date="2036-01-15" data-time="00:35:00" class="discourse-local-date cooked-date past" data-timezone="Europe/London">
|
||||
<span>
|
||||
<svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg">
|
||||
<use xlink:href="#globe-americas"></use>
|
||||
<use href="#globe-americas"></use>
|
||||
</svg>
|
||||
<span class="relative-time">January 15, 2036 12:35 AM</span>
|
||||
</span>
|
||||
|
@ -71,7 +71,7 @@ acceptance("Bookmarking", function (needs) {
|
|||
topicResponse.post_stream.posts[1].cooked += `<span data-date="2021-01-15" data-time="00:35:00" class="discourse-local-date cooked-date past" data-timezone="Europe/London">
|
||||
<span>
|
||||
<svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg">
|
||||
<use xlink:href="#globe-americas"></use>
|
||||
<use href="#globe-americas"></use>
|
||||
</svg>
|
||||
<span class="relative-time">Today 10:30 AM</span>
|
||||
</span>
|
||||
|
|
|
@ -17,7 +17,7 @@ discourseModule("Integration | Component | d-icon", function (hooks) {
|
|||
const html = queryAll(".test").html().trim();
|
||||
assert.strictEqual(
|
||||
html,
|
||||
'<svg class="fa d-icon d-icon-bars svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#bars"></use></svg>'
|
||||
'<svg class="fa d-icon d-icon-bars svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#bars"></use></svg>'
|
||||
);
|
||||
},
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ discourseModule("Integration | Component | d-icon", function (hooks) {
|
|||
const html = queryAll(".test").html().trim();
|
||||
assert.strictEqual(
|
||||
html,
|
||||
'<svg class="fa d-icon d-icon-d-watching svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#discourse-bell-exclamation"></use></svg>'
|
||||
'<svg class="fa d-icon d-icon-d-watching svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#discourse-bell-exclamation"></use></svg>'
|
||||
);
|
||||
},
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ import { module, test } from "qunit";
|
|||
|
||||
module("Unit | Utility | icon-library", function () {
|
||||
test("return icon markup", function (assert) {
|
||||
assert.ok(iconHTML("bars").indexOf('use xlink:href="#bars"') > -1);
|
||||
assert.ok(iconHTML("bars").indexOf('use href="#bars"') > -1);
|
||||
|
||||
const nodeIcon = iconNode("bars");
|
||||
assert.strictEqual(nodeIcon.tagName, "svg");
|
||||
|
|
|
@ -404,7 +404,7 @@ helloWorld();</code>consectetur.`;
|
|||
<p>there is a quote below</p>
|
||||
<aside class="quote no-group" data-username="foo" data-post="1" data-topic="2">
|
||||
<div class="title" style="cursor: pointer;">
|
||||
<div class="quote-controls"><span class="svg-icon-title" title="expand/collapse"><svg class="fa d-icon d-icon-chevron-down svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#chevron-down"></use></svg></span><a href="/t/hello-world-i-am-posting-an-image/158/1" title="go to the quoted post" class="back"><svg class="fa d-icon d-icon-arrow-up svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use xlink:href="#arrow-up"></use></svg></a></div>
|
||||
<div class="quote-controls"><span class="svg-icon-title" title="expand/collapse"><svg class="fa d-icon d-icon-chevron-down svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#chevron-down"></use></svg></span><a href="/t/hello-world-i-am-posting-an-image/158/1" title="go to the quoted post" class="back"><svg class="fa d-icon d-icon-arrow-up svg-icon svg-string" xmlns="http://www.w3.org/2000/svg"><use href="#arrow-up"></use></svg></a></div>
|
||||
<img alt="" width="20" height="20" src="" class="avatar"> foo:</div>
|
||||
<blockquote>
|
||||
<p>this is a quote</p>
|
||||
|
|
|
@ -19,8 +19,8 @@ svg > use {
|
|||
// Stacked Icons
|
||||
// Usage:
|
||||
// <span class="fa-stack">
|
||||
// <svg class="... d-icon-icon1 fa-stack-1x ..." xmlns="http://www.w3.org/2000/svg"><use xlink:href="#icon1"></use></svg>
|
||||
// <svg class="... d-icon-icon2 fa-stack-2x ..." xmlns="http://www.w3.org/2000/svg"><use xlink:href="#icon2"></use></svg>
|
||||
// <svg class="... d-icon-icon1 fa-stack-1x ..." xmlns="http://www.w3.org/2000/svg"><use href="#icon1"></use></svg>
|
||||
// <svg class="... d-icon-icon2 fa-stack-2x ..." xmlns="http://www.w3.org/2000/svg"><use href="#icon2"></use></svg>
|
||||
// </span>
|
||||
// -------------------------
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
<% if staff? %>
|
||||
<p><a href='<%= @topic.url %>'>
|
||||
<svg class="fa d-icon d-icon-pencil-alt svg-icon" xmlns="http://www.w3.org/2000/svg">
|
||||
<use xlink:href="#pencil-alt"></use>
|
||||
<use href="#pencil-alt"></use>
|
||||
</svg>
|
||||
<%= t 'edit_this_page' %>
|
||||
</a></p>
|
||||
|
|
|
@ -184,7 +184,7 @@ class CookedPostProcessor
|
|||
img.name = "span"
|
||||
img.set_attribute("class", "broken-image")
|
||||
img.set_attribute("title", I18n.t("post.image_placeholder.broken"))
|
||||
img << "<svg class=\"fa d-icon d-icon-unlink svg-icon\" aria-hidden=\"true\"><use xlink:href=\"#unlink\"></use></svg>"
|
||||
img << "<svg class=\"fa d-icon d-icon-unlink svg-icon\" aria-hidden=\"true\"><use href=\"#unlink\"></use></svg>"
|
||||
img.remove_attribute("src")
|
||||
img.remove_attribute("width")
|
||||
img.remove_attribute("height")
|
||||
|
|
|
@ -265,7 +265,7 @@ module CookedProcessorMixin
|
|||
img.name = "span"
|
||||
img.set_attribute("class", "broken-image")
|
||||
img.set_attribute("title", I18n.t("post.image_placeholder.broken"))
|
||||
img << "<svg class=\"fa d-icon d-icon-unlink svg-icon\" aria-hidden=\"true\"><use xlink:href=\"#unlink\"></use></svg>"
|
||||
img << "<svg class=\"fa d-icon d-icon-unlink svg-icon\" aria-hidden=\"true\"><use href=\"#unlink\"></use></svg>"
|
||||
img.remove_attribute("src")
|
||||
img.remove_attribute("width")
|
||||
img.remove_attribute("height")
|
||||
|
@ -326,7 +326,7 @@ module CookedProcessorMixin
|
|||
def create_icon_node(klass)
|
||||
icon = create_node("svg", "fa d-icon d-icon-#{klass} svg-icon")
|
||||
icon.set_attribute("aria-hidden", "true")
|
||||
icon << "<use xlink:href=\"##{klass}\"></use>"
|
||||
icon << "<use href=\"##{klass}\"></use>"
|
||||
end
|
||||
|
||||
def create_node(tag_name, klass)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
{{#location}}
|
||||
<span class="location">
|
||||
<svg class="fa d-icon d-icon-map-marker-alt svg-icon" xmlns="http://www.w3.org/2000/svg">
|
||||
<use xlink:href="#map-marker-alt"></use>
|
||||
<use href="#map-marker-alt"></use>
|
||||
</svg>
|
||||
{{{location}}}
|
||||
</span>
|
||||
|
@ -17,7 +17,7 @@
|
|||
{{#website}}
|
||||
<span>
|
||||
<svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg">
|
||||
<use xlink:href="#globe-americas"></use>
|
||||
<use href="#globe-americas"></use>
|
||||
</svg>
|
||||
<a href="{{website}}">{{{website_name}}}</a>
|
||||
</span>
|
||||
|
|
|
@ -406,9 +406,6 @@ class UploadCreator
|
|||
if use_el.attr('href')
|
||||
use_el.remove_attribute('href') unless use_el.attr('href').starts_with?('#')
|
||||
end
|
||||
if use_el.attr('xlink:href')
|
||||
use_el.remove_attribute('xlink:href') unless use_el.attr('xlink:href').starts_with?('#')
|
||||
end
|
||||
end
|
||||
File.write(@file.path, doc.to_s)
|
||||
@file.rewind
|
||||
|
|
|
@ -24,7 +24,7 @@ export function applyLocalDates(dates, siteSettings) {
|
|||
"beforeend",
|
||||
`
|
||||
<svg class="fa d-icon d-icon-globe-americas svg-icon" xmlns="http://www.w3.org/2000/svg">
|
||||
<use xlink:href="#globe-americas"></use>
|
||||
<use href="#globe-americas"></use>
|
||||
</svg>
|
||||
<span class="relative-time">${localDateBuilder.formated}</span>
|
||||
`
|
||||
|
|
|
@ -454,7 +454,7 @@ test("previews", function (assert) {
|
|||
{
|
||||
current: true,
|
||||
formated:
|
||||
'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 12:00 AM → 1:30 AM',
|
||||
'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 12:00 AM → 1:30 AM',
|
||||
timezone: "Paris",
|
||||
},
|
||||
],
|
||||
|
@ -486,7 +486,7 @@ test("previews", function (assert) {
|
|||
{
|
||||
current: true,
|
||||
formated:
|
||||
'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 11:34 AM',
|
||||
'Sunday, March 22, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 11:34 AM',
|
||||
timezone: "Paris",
|
||||
},
|
||||
],
|
||||
|
@ -542,22 +542,22 @@ test("previews", function (assert) {
|
|||
{
|
||||
current: true,
|
||||
formated:
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 2:54 PM',
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 2:54 PM',
|
||||
timezone: "Paris",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 1:54 PM',
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:54 PM',
|
||||
timezone: "London",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 1:54 PM',
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 1:54 PM',
|
||||
timezone: "Lagos",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 10:54 PM',
|
||||
'Tuesday, April 7, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 10:54 PM',
|
||||
timezone: "Sydney",
|
||||
},
|
||||
],
|
||||
|
@ -577,12 +577,12 @@ test("previews", function (assert) {
|
|||
{
|
||||
current: true,
|
||||
formated:
|
||||
'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 11:00 AM',
|
||||
'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 11:00 AM',
|
||||
timezone: "Los Angeles",
|
||||
},
|
||||
{
|
||||
formated:
|
||||
'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use xlink:href="#clock" /></svg> 6:00 PM',
|
||||
'Wednesday, May 13, 2020 <br /><svg class=\'fa d-icon d-icon-clock svg-icon svg-string\' xmlns="http://www.w3.org/2000/svg"><use href="#clock" /></svg> 6:00 PM',
|
||||
timezone: "UTC",
|
||||
},
|
||||
],
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
<stop offset=".66" stop-color="#d5ddd5"/>
|
||||
<stop offset="1" stop-color="#00261b"/>
|
||||
</linearGradient>
|
||||
<linearGradient id="GradientFill_24-2" x1="191.602" y1="42.264" x2="176.257" y2="44.148" xlink:href="#GradientFill_24"/>
|
||||
<linearGradient id="GradientFill_25-2" x1="154.552" y1="42.724" x2="228.015" y2="42.724" xlink:href="#GradientFill_25"/>
|
||||
<linearGradient id="GradientFill_26-2" x1="197.635" y1="41.717" x2="240.259" y2="41.717" xlink:href="#GradientFill_26"/>
|
||||
<linearGradient id="GradientFill_24-2" x1="191.602" y1="42.264" x2="176.257" y2="44.148" href="#GradientFill_24"/>
|
||||
<linearGradient id="GradientFill_25-2" x1="154.552" y1="42.724" x2="228.015" y2="42.724" href="#GradientFill_25"/>
|
||||
<linearGradient id="GradientFill_26-2" x1="197.635" y1="41.717" x2="240.259" y2="41.717" href="#GradientFill_26"/>
|
||||
<linearGradient id="GradientFill_27" x1="175.02" y1="48.198" x2="238.546" y2="47.089" gradientUnits="userSpaceOnUse">
|
||||
<stop offset="0" stop-color="#416857"/>
|
||||
<stop offset="1" stop-color="#fff"/>
|
||||
|
|
Before Width: | Height: | Size: 495 KiB After Width: | Height: | Size: 495 KiB |
|
@ -415,7 +415,7 @@ describe CookedPostProcessor do
|
|||
cpp.post_process
|
||||
|
||||
expect(cpp.html).to match_html <<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="logo.png"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">logo.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="logo.png"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">logo.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
HTML
|
||||
|
||||
expect(cpp).to be_dirty
|
||||
|
@ -496,7 +496,7 @@ describe CookedPostProcessor do
|
|||
let(:cooked_html) do
|
||||
<<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost/secure-media-uploads/original/1X/#{upload.sha1}.png" data-download-href="//test.localhost/uploads/short-url/#{upload.base62_sha1}.unknown?dl=1" title="large.png"><img src="" alt="large.png" data-base62-sha1="#{upload.base62_sha1}" width="600" height="500"><div class="meta">
|
||||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">large.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg>
|
||||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">large.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg>
|
||||
</div></a></div></p>
|
||||
HTML
|
||||
end
|
||||
|
@ -578,7 +578,7 @@ describe CookedPostProcessor do
|
|||
cpp.post_process
|
||||
|
||||
expect(cpp.html).to match_html <<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="logo.png"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_230x500.png" width="230" height="500"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">logo.png</span><span class="informations">1125×2436 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="logo.png"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_230x500.png" width="230" height="500"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">logo.png</span><span class="informations">1125×2436 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
HTML
|
||||
|
||||
expect(cpp).to be_dirty
|
||||
|
@ -609,7 +609,7 @@ describe CookedPostProcessor do
|
|||
cpp.post_process
|
||||
|
||||
expect(cpp.html). to match_html <<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost/subfolder#{upload.url}" data-download-href="//test.localhost/subfolder/#{upload_path}/#{upload.sha1}" title="logo.png"><img src="//test.localhost/subfolder/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">logo.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost/subfolder#{upload.url}" data-download-href="//test.localhost/subfolder/#{upload_path}/#{upload.sha1}" title="logo.png"><img src="//test.localhost/subfolder/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">logo.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
HTML
|
||||
|
||||
expect(cpp).to be_dirty
|
||||
|
@ -620,7 +620,7 @@ describe CookedPostProcessor do
|
|||
cpp.post_process
|
||||
|
||||
expect(cpp.html).to match_html <<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost/subfolder#{upload.url}" data-download-href="//test.localhost/subfolder/#{upload_path}/#{upload.sha1}" title="&gt;&lt;img src=x onerror=alert(&#39;haha&#39;)&gt;.png"><img src="//test.localhost/subfolder/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">&gt;&lt;img src=x onerror=alert(&#39;haha&#39;)&gt;.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost/subfolder#{upload.url}" data-download-href="//test.localhost/subfolder/#{upload_path}/#{upload.sha1}" title="&gt;&lt;img src=x onerror=alert(&#39;haha&#39;)&gt;.png"><img src="//test.localhost/subfolder/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">&gt;&lt;img src=x onerror=alert(&#39;haha&#39;)&gt;.png</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
HTML
|
||||
end
|
||||
|
||||
|
@ -646,7 +646,7 @@ describe CookedPostProcessor do
|
|||
cpp.post_process
|
||||
|
||||
expect(cpp.html).to match_html <<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="WAT"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" title="WAT" alt="RED" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">WAT</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="WAT"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" title="WAT" alt="RED" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">WAT</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
HTML
|
||||
|
||||
expect(cpp).to be_dirty
|
||||
|
@ -674,7 +674,7 @@ describe CookedPostProcessor do
|
|||
cpp.post_process
|
||||
|
||||
expect(cpp.html).to match_html <<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="WAT"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" title="WAT" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">WAT</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="WAT"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" title="WAT" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">WAT</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
HTML
|
||||
|
||||
expect(cpp).to be_dirty
|
||||
|
@ -702,7 +702,7 @@ describe CookedPostProcessor do
|
|||
cpp.post_process
|
||||
|
||||
expect(cpp.html).to match_html <<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="RED"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" alt="RED" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">RED</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//test.localhost#{upload.url}" data-download-href="//test.localhost/#{upload_path}/#{upload.sha1}" title="RED"><img src="//test.localhost/#{upload_path}/optimized/1X/#{upload.sha1}_#{OptimizedImage::VERSION}_690x788.png" alt="RED" width="690" height="788"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">RED</span><span class="informations">1750×2000 1.21 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
|
||||
HTML
|
||||
|
||||
expect(cpp).to be_dirty
|
||||
|
|
|
@ -35,7 +35,7 @@ describe UserNotificationsHelper do
|
|||
let(:lightbox_image) do
|
||||
<<~HTML
|
||||
<p><div class="lightbox-wrapper"><a class="lightbox" href="//localhost:3000/uploads/default/original/1X/123456.jpeg" data-download-href="//localhost:3000/uploads/default/123456" title="giant-meteor-2020"><img src="//localhost:3000/uploads/default/original/1X/123456.jpeg" alt="giant-meteor-2020" data-base62-sha1="3jcR88161od6Uthq1ixWKJh2ejp" width="517" height="152" data-small-upload="//localhost:3000/uploads/default/optimized/1X/123456_2_10x10.png"><div class="meta">
|
||||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg><span class="filename">giant-meteor-2020</span><span class="informations">851×251 44 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg>
|
||||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">giant-meteor-2020</span><span class="informations">851×251 44 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg>
|
||||
</div></a></div></p>
|
||||
HTML
|
||||
end
|
||||
|
|
|
@ -561,10 +561,10 @@ RSpec.describe UploadCreator do
|
|||
<path id="pathdef" d="m0 0h100v100h-77z" stroke="#000" />
|
||||
</defs>
|
||||
<g>
|
||||
<use id="valid-use" x="123" xlink:href="#pathdef" />
|
||||
<use id="valid-use" x="123" href="#pathdef" />
|
||||
</g>
|
||||
<use id="invalid-use1" href="https://svg.example.com/evil.svg" />
|
||||
<use id="invalid-use2" xlink:href="data:image/svg+xml;base64,#{b64}" />
|
||||
<use id="invalid-use2" href="data:image/svg+xml;base64,#{b64}" />
|
||||
</svg>
|
||||
XML
|
||||
file.rewind
|
||||
|
|
|
@ -86,10 +86,10 @@ describe SearchIndexer do
|
|||
<a class="lightbox" href="#{Discourse.base_url_no_prefix}/uploads/episodeinteractive/original/3X/1/6/16790095df3baf318fb2eb1d7e5d7860dc45d48b.jpg" data-download-href="#{Discourse.base_url_no_prefix}/uploads/episodeinteractive/16790095df3baf318fb2eb1d7e5d7860dc45d48b" title="Untitled design (21).jpg" rel="nofollow noopener">
|
||||
<img src="#{Discourse.base_url_no_prefix}/uploads/episodeinteractive/optimized/3X/1/6/16790095df3baf318fb2eb1d7e5d7860dc45d48b_1_563x500.jpg" alt="Untitled%20design%20(21)" width="563" height="500">
|
||||
<div class="meta">
|
||||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use xlink:href="#far-image"></use></svg>
|
||||
<svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg>
|
||||
<span class="filename">Untitled design (21).jpg</span>
|
||||
<span class="informations">1280x1136 472 KB</span>
|
||||
<svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use xlink:href="#discourse-expand"></use></svg>
|
||||
<svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg>
|
||||
</div>
|
||||
</a>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue