Skip to content

Commit ffa5b4a

Browse files
committed
fix: use field-specific bozo_exception messages and fix read_text_str docs
Use distinct bozo_exception messages per field (channel title, channel description, feed id) instead of generic message. Fix read_text_str doc comment to accurately reflect usage at entry-level call sites where bozo propagation is not yet implemented.
1 parent 1ff584a commit ffa5b4a

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

crates/feedparser-rs-core/src/parser/atom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ fn parse_feed_element(
157157
if bozo {
158158
feed.bozo = true;
159159
feed.bozo_exception =
160-
Some("Unresolvable entity in feed content".to_string());
160+
Some("Unresolvable entity in feed id".to_string());
161161
}
162162
feed.feed.id = Some(text);
163163
}

crates/feedparser-rs-core/src/parser/common.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,9 @@ pub fn skip_element(
474474

475475
/// Read text content, discarding the bozo signal.
476476
///
477-
/// Use this at call sites where `feed` is not in scope and bozo propagation
478-
/// is handled by a higher-level caller, or where the text field is metadata
479-
/// that does not carry entity content from untrusted feeds.
477+
/// Use this at call sites where `ParsedFeed` is not in scope and bozo
478+
/// propagation to the feed level is not yet implemented, such as entry-level
479+
/// fields (title, summary, content, author, etc.). See #70.
480480
#[inline]
481481
pub fn read_text_str(
482482
reader: &mut Reader<&[u8]>,

crates/feedparser-rs-core/src/parser/rss.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,8 @@ fn parse_channel_standard(
343343
let (text, bozo) = read_text(reader, buf, limits)?;
344344
if bozo {
345345
feed.bozo = true;
346-
feed.bozo_exception = Some("Unresolvable entity in feed content".to_string());
346+
feed.bozo_exception =
347+
Some("Unresolvable entity in channel title".to_string());
347348
}
348349
feed.feed.set_title(TextConstruct {
349350
value: text,
@@ -365,7 +366,8 @@ fn parse_channel_standard(
365366
let (text, bozo) = read_text(reader, buf, limits)?;
366367
if bozo {
367368
feed.bozo = true;
368-
feed.bozo_exception = Some("Unresolvable entity in feed content".to_string());
369+
feed.bozo_exception =
370+
Some("Unresolvable entity in channel description".to_string());
369371
}
370372
feed.feed.set_subtitle(TextConstruct {
371373
value: text,

0 commit comments

Comments
 (0)