Changeset - a93c07ade43a
[Not reviewed]
beta
0 1 0
Marcin Kuzminski - 13 years ago 2012-09-02 23:29:07
marcin@python-works.com
Added huge diff protection for RSS/ATOM feeds.
It can really be a performance killer for huge diffs.
1 file changed with 8 insertions and 2 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/feed.py
Show inline comments
 
@@ -59,8 +59,14 @@ class FeedController(BaseRepoController)
 

	
 
    def __changes(self, cs):
 
        changes = []
 

	
 
        diffprocessor = DiffProcessor(cs.diff())
 
        _diff = cs.diff()
 
        # we need to protect from parsing huge diffs here other way
 
        # we can kill the server, 32*1024 chars is a reasonable limit
 
        HUGE_DIFF = 32 * 1024
 
        if len(_diff) > HUGE_DIFF:
 
            changes = ['\n ' + _('Changeset was too big and was cut off...')]
 
            return changes
 
        diffprocessor = DiffProcessor(_diff)
 
        stats = diffprocessor.prepare(inline_diff=False)
 
        for st in stats:
 
            st.update({'added': st['stats'][0],
0 comments (0 inline, 0 general)