Comparison

mod_pubsub_feeds/mod_pubsub_feeds.lua @ 4883:68bd8ae9b827

mod_pubsub_feeds: Allow but ignore XML comments and processing instructions This should allow but ignore them, which should be safe.
author Kim Alvefur <zash@zash.se>
date Fri, 04 Feb 2022 21:22:10 +0100
parent 4282:281a864e7472
child 5569:1f8c9e27b625
comparison
equal deleted inserted replaced
4882:28f6322fad50 4883:68bd8ae9b827
24 local translate_rss = module:require("feeds").translate_rss; 24 local translate_rss = module:require("feeds").translate_rss;
25 25
26 local xmlns_atom = "http://www.w3.org/2005/Atom"; 26 local xmlns_atom = "http://www.w3.org/2005/Atom";
27 27
28 local function parse_feed(data) 28 local function parse_feed(data)
29 local feed, err = parse_xml(data); 29 local feed, err = parse_xml(data, { allow_processing_instructions = true; allow_comments = true });
30 if not feed then return feed, err; end 30 if not feed then return feed, err; end
31 if feed.attr.xmlns == xmlns_atom then 31 if feed.attr.xmlns == xmlns_atom then
32 return feed; 32 return feed;
33 elseif feed.attr.xmlns == nil and feed.name == "rss" then 33 elseif feed.attr.xmlns == nil and feed.name == "rss" then
34 return translate_rss(feed); 34 return translate_rss(feed);