Edgewall Software

Ticket #2672: trac-0.11.2.1-dont_show_binary_pdf_differences.diff

File trac-0.11.2.1-dont_show_binary_pdf_differences.diff, 460 bytes (added by public@…, 3 years ago)

Workaround for trac-0.11.2.1

  • trac/mimeview/api.py

    old new def is_binary(data): 
    421421    """ 
    422422    if isinstance(data, str) and detect_unicode(data): 
    423423        return False 
    424     return '\0' in data[:1000] 
     424    return ('\0' in data[:1000]) or data.startswith('%PDF-') 
    425425 
    426426def detect_unicode(data): 
    427427    """Detect different unicode charsets by looking for BOMs (Byte Order Marks).