fixup! /source.json: don't encode '&' as '&' in commentaries.
This commit is contained in:
@@ -102,6 +102,7 @@ module Sources
|
|||||||
# Convert commentary to dtext by stripping html tags. Sites can override
|
# Convert commentary to dtext by stripping html tags. Sites can override
|
||||||
# this to customize how their markup is translated to dtext.
|
# this to customize how their markup is translated to dtext.
|
||||||
def self.to_dtext(text)
|
def self.to_dtext(text)
|
||||||
|
text = text.to_s
|
||||||
text = Rails::Html::FullSanitizer.new.sanitize(text, encode_special_chars: false)
|
text = Rails::Html::FullSanitizer.new.sanitize(text, encode_special_chars: false)
|
||||||
text = CGI::unescapeHTML(text)
|
text = CGI::unescapeHTML(text)
|
||||||
text
|
text
|
||||||
|
|||||||
@@ -91,6 +91,8 @@ module Sources
|
|||||||
should "get the artist commentary" do
|
should "get the artist commentary" do
|
||||||
assert_not_nil(@site.artist_commentary_title)
|
assert_not_nil(@site.artist_commentary_title)
|
||||||
assert_not_nil(@site.artist_commentary_desc)
|
assert_not_nil(@site.artist_commentary_desc)
|
||||||
|
assert_not_nil(@site.dtext_artist_commentary_title)
|
||||||
|
assert_not_nil(@site.dtext_artist_commentary_desc)
|
||||||
end
|
end
|
||||||
|
|
||||||
should "convert a page into a json representation" do
|
should "convert a page into a json representation" do
|
||||||
@@ -113,6 +115,17 @@ module Sources
|
|||||||
assert_equal("https://i.pximg.net/img-original/img/2014/10/29/09/27/19/46785915_p0.jpg", @site.image_url)
|
assert_equal("https://i.pximg.net/img-original/img/2014/10/29/09/27/19/46785915_p0.jpg", @site.image_url)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context "fetching the commentary" do
|
||||||
|
setup do
|
||||||
|
get_source("https://www.pixiv.net/member_illust.php?mode=medium&illust_id=46337015")
|
||||||
|
end
|
||||||
|
|
||||||
|
should "work when the description is blank" do
|
||||||
|
assert_equal("Illustration (PNG) - foo & bar", @site.dtext_artist_commentary_title)
|
||||||
|
assert_equal("", @site.dtext_artist_commentary_desc)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user