Skip to content

Commit e44b452

Browse files
authored
Merge pull request #9973 from Turbo87/rss-escaping
rss: Remove explicit/duplicate XML escaping
2 parents 732b81f + 6154581 commit e44b452

8 files changed

+7
-8
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ parking_lot = "=0.12.3"
9595
paste = "=1.0.15"
9696
postgres-native-tls = "=0.5.0"
9797
prometheus = { version = "=0.13.4", default-features = false }
98-
quick-xml = "=0.37.0"
9998
rand = "=0.8.5"
10099
reqwest = { version = "=0.12.9", features = ["gzip", "json"] }
101100
rss = { version = "=2.0.10", default-features = false, features = ["atom"] }

src/tests/worker/rss/snapshots/crates_io__tests__worker__rss__sync_crates_feed__sync_crates_feed-2.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ snapshot_kind: text
2121
<item>
2222
<title>New crate created: baz</title>
2323
<link>https://crates.io/crates/baz</link>
24-
<description><![CDATA[does it handle XML? &lt;item&gt;]]></description>
24+
<description><![CDATA[does it handle XML? <item> ]]]]><![CDATA[>]]></description>
2525
<guid>https://crates.io/crates/baz</guid>
2626
<pubDate>Fri, 21 Jun 2024 17:01:33 +0000</pubDate>
2727
<crates:name>baz</crates:name>

src/tests/worker/rss/snapshots/crates_io__tests__worker__rss__sync_updates_feed__sync_updates_feed-2.snap

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
---
22
source: src/tests/worker/rss/sync_updates_feed.rs
33
expression: content
4+
snapshot_kind: text
45
---
56
<?xml version="1.0" encoding="utf-8"?>
67
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:crates="https://crates.io/">
@@ -29,7 +30,7 @@ expression: content
2930
<item>
3031
<title>New crate version published: bar v3.0.0-beta.1</title>
3132
<link>https://crates.io/crates/bar/3.0.0-beta.1</link>
32-
<description><![CDATA[let&apos;s try &amp; break this &lt;item&gt;]]></description>
33+
<description><![CDATA[let's try & break this <item> ]]]]><![CDATA[>]]></description>
3334
<guid>https://crates.io/crates/bar/3.0.0-beta.1</guid>
3435
<pubDate>Fri, 21 Jun 2024 17:03:45 +0000</pubDate>
3536
<crates:name>bar</crates:name>

src/tests/worker/rss/sync_crates_feed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async fn test_sync_crates_feed() {
1515
let description = Some("something something foo");
1616
create_crate(&mut conn, "foo", description, "2024-06-20T10:13:54Z").await;
1717
create_crate(&mut conn, "bar", None, "2024-06-20T12:45:12Z").await;
18-
let description = Some("does it handle XML? <item>");
18+
let description = Some("does it handle XML? <item> ]]>");
1919
create_crate(&mut conn, "baz", description, "2024-06-21T17:01:33Z").await;
2020
create_crate(&mut conn, "quux", None, "2024-06-21T17:03:45Z").await;
2121

src/tests/worker/rss/sync_updates_feed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ async fn test_sync_updates_feed() {
1212
let (app, _) = TestApp::full().empty();
1313
let mut conn = app.async_db_conn().await;
1414

15-
let d = Some("let's try & break this <item>");
15+
let d = Some("let's try & break this <item> ]]>");
1616

1717
create_version(&mut conn, "foo", "0.1.0", None, "2024-06-20T10:13:54Z").await;
1818
create_version(&mut conn, "foo", "0.1.1", None, "2024-06-20T12:45:12Z").await;

src/worker/jobs/rss/sync_crates_feed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ impl NewCrate {
127127

128128
let description = self
129129
.description
130-
.map(|d| quick_xml::escape::escape(&d).to_string());
130+
.map(|d| d.replace("]]>", "]]]]><![CDATA[>"));
131131

132132
let name_extension = rss::extension::Extension {
133133
name: "crates:name".into(),

src/worker/jobs/rss/sync_updates_feed.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ impl VersionUpdate {
134134

135135
let description = self
136136
.description
137-
.map(|d| quick_xml::escape::escape(&d).to_string());
137+
.map(|d| d.replace("]]>", "]]]]><![CDATA[>"));
138138

139139
let name_extension = rss::extension::Extension {
140140
name: "crates:name".into(),

0 commit comments

Comments
 (0)