Skip to content

Commit ee9ce44

Browse files
committed
rss: Remove explicit/duplicate XML escaping
XML tags inside `CDATA` sections don't need to be escaped, so this explicit escaping step led to an unnecessary duplicate escaping being applied.
1 parent 3640ab0 commit ee9ce44

File tree

6 files changed

+5
-14
lines changed

6 files changed

+5
-14
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>]]></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>]]></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/worker/jobs/rss/sync_crates_feed.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,10 +125,6 @@ impl NewCrate {
125125
permalink: true,
126126
};
127127

128-
let description = self
129-
.description
130-
.map(|d| quick_xml::escape::escape(&d).to_string());
131-
132128
let name_extension = rss::extension::Extension {
133129
name: "crates:name".into(),
134130
value: Some(self.name),
@@ -144,7 +140,7 @@ impl NewCrate {
144140
guid: Some(guid),
145141
title: Some(title),
146142
link: Some(link),
147-
description,
143+
description: self.description,
148144
pub_date: Some(pub_date),
149145
extensions,
150146
..Default::default()

src/worker/jobs/rss/sync_updates_feed.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,6 @@ impl VersionUpdate {
132132
permalink: true,
133133
};
134134

135-
let description = self
136-
.description
137-
.map(|d| quick_xml::escape::escape(&d).to_string());
138-
139135
let name_extension = rss::extension::Extension {
140136
name: "crates:name".into(),
141137
value: Some(self.name),
@@ -160,7 +156,7 @@ impl VersionUpdate {
160156
guid: Some(guid),
161157
title: Some(title),
162158
link: Some(link),
163-
description,
159+
description: self.description,
164160
pub_date: Some(pub_date),
165161
extensions,
166162
..Default::default()

0 commit comments

Comments
 (0)