Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rss: Remove explicit/duplicate XML escaping #9973

Merged
merged 2 commits into from
Nov 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ parking_lot = "=0.12.3"
paste = "=1.0.15"
postgres-native-tls = "=0.5.0"
prometheus = { version = "=0.13.4", default-features = false }
quick-xml = "=0.37.0"
rand = "=0.8.5"
reqwest = { version = "=0.12.9", features = ["gzip", "json"] }
rss = { version = "=2.0.10", default-features = false, features = ["atom"] }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ snapshot_kind: text
<item>
<title>New crate created: baz</title>
<link>https://crates.io/crates/baz</link>
<description><![CDATA[does it handle XML? &lt;item&gt;]]></description>
<description><![CDATA[does it handle XML? <item> ]]]]><![CDATA[>]]></description>
<guid>https://crates.io/crates/baz</guid>
<pubDate>Fri, 21 Jun 2024 17:01:33 +0000</pubDate>
<crates:name>baz</crates:name>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
source: src/tests/worker/rss/sync_updates_feed.rs
expression: content
snapshot_kind: text
---
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:crates="https://crates.io/">
Expand Down Expand Up @@ -29,7 +30,7 @@ expression: content
<item>
<title>New crate version published: bar v3.0.0-beta.1</title>
<link>https://crates.io/crates/bar/3.0.0-beta.1</link>
<description><![CDATA[let&apos;s try &amp; break this &lt;item&gt;]]></description>
<description><![CDATA[let's try & break this <item> ]]]]><![CDATA[>]]></description>
<guid>https://crates.io/crates/bar/3.0.0-beta.1</guid>
<pubDate>Fri, 21 Jun 2024 17:03:45 +0000</pubDate>
<crates:name>bar</crates:name>
Expand Down
2 changes: 1 addition & 1 deletion src/tests/worker/rss/sync_crates_feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async fn test_sync_crates_feed() {
let description = Some("something something foo");
create_crate(&mut conn, "foo", description, "2024-06-20T10:13:54Z").await;
create_crate(&mut conn, "bar", None, "2024-06-20T12:45:12Z").await;
let description = Some("does it handle XML? <item>");
let description = Some("does it handle XML? <item> ]]>");
create_crate(&mut conn, "baz", description, "2024-06-21T17:01:33Z").await;
create_crate(&mut conn, "quux", None, "2024-06-21T17:03:45Z").await;

Expand Down
2 changes: 1 addition & 1 deletion src/tests/worker/rss/sync_updates_feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ async fn test_sync_updates_feed() {
let (app, _) = TestApp::full().empty();
let mut conn = app.async_db_conn().await;

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

create_version(&mut conn, "foo", "0.1.0", None, "2024-06-20T10:13:54Z").await;
create_version(&mut conn, "foo", "0.1.1", None, "2024-06-20T12:45:12Z").await;
Expand Down
2 changes: 1 addition & 1 deletion src/worker/jobs/rss/sync_crates_feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl NewCrate {

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

let name_extension = rss::extension::Extension {
name: "crates:name".into(),
Expand Down
2 changes: 1 addition & 1 deletion src/worker/jobs/rss/sync_updates_feed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl VersionUpdate {

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

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