Edgewall Software
Modify

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#13196 closed defect (fixed)

Link tags in RSS feed mangled on Trac 1.3.6

Reported by: niels.reedijk@… Owned by: Jun Omae
Priority: normal Milestone: 1.4.1
Component: rendering Version: 1.3.6
Severity: normal Keywords:
Cc: Branch:
Release Notes:

Fixed malformed content of RSS feed when Genshi stream filters exist.

API Changes:
Internal Changes:

Description

When this plugin is enabled, the RSS feed is malformed, in that the link tags are botched. See our timeline RSS feed for an example.

We are using the trunk module, revision r17015.

Attachments (0)

Change History (8)

comment:1 by Jun Omae, 5 years ago

Milestone: plugin - spam-filter

Work around:

  • tracspamfilter/filters/trapfield.py

     
    9090
    9191    # ITemplateStreamFilter interface
    9292    def filter_stream(self, req, method, filename, stream, data):
     93        if method != 'html':
     94            return stream
    9395        if self.karma_points > 0:
    9496            # Insert the hidden field right before the submit buttons
    9597            trap = tag.div(style='display:none;')(

I think the plugin for 1.4-stable should be created.

comment:3 by Jun Omae, 5 years ago

Milestone: plugin - spam-filter1.4.1

Root cause is that Trac core uses genshi.input.HTML to generate a genshi.core.Stream instance for an XML content. Instead, we should use genshi.input.XML for.

  • trac/web/chrome.py

    diff --git a/trac/web/chrome.py b/trac/web/chrome.py
    index 1bbb5f665..b29d580fd 100644
    a b from trac.util.html import genshi  
    3838if genshi:
    3939    from genshi.core import Attrs, START
    4040    from genshi.filters import Translator
    41     from genshi.input import HTML
     41    from genshi.input import HTML, XML
    4242    from genshi.output import DocType
    4343    from genshi.template import TemplateLoader, MarkupTemplate, NewTextTemplate
    4444
    class Chrome(Component):  
    19381938        def _filter_jinja_page(self, req, content, method, filename,
    19391939                               content_type, data, fragment, iterable):
    19401940            doctype = self.html_doctype if content_type == 'text/html' else None
    1941             stream = HTML(content)
     1941            stream = HTML(content) if method != 'xml' else XML(content)
    19421942            stream |= self._filter_stream(req, method, filename, data)
    19431943            if fragment:
    19441944                return stream

TODO

  • Add unit tests.
  • Check the behavior of _filter_jinja_page() for text templates.

comment:4 by Jun Omae, 5 years ago

comment:5 by Ryan J Ollos, 5 years ago

Changes look good to me.

comment:6 by Jun Omae, 5 years ago

Owner: changed from Dirk Stöcker to Jun Omae
Release Notes: modified (diff)
Status: newassigned

Thanks for the reviewing. Committed in [17145].

comment:7 by Jun Omae, 5 years ago

Resolution: fixed
Status: assignedclosed

comment:8 by Ryan J Ollos, 5 years ago

Component: plugin/spamfilterrendering

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain Jun Omae.
The resolution will be deleted. Next status will be 'reopened'.
to The owner will be changed from Jun Omae to the specified user.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.