Comment 0 for bug 1292841

Revision history for this message
m4mmon (m4mmon) wrote :

When editing a book, if html page contains an empty style tag, check crashes.

Calibre 1.28 64-bit windows.

How to reproduce :
In edit book, edit a page and add :
<style type="text/css" />
or
<style type="text/css"></style>

to the head of the file. For example:

   <head>
      <title>My book</title>
      <link href="stylesheet1.css" type="text/css" rel="stylesheet" />
      <style type="text/css"></style>
   </head>

Now run "Check book", it will error out with this error message :

calibre, version 1.28.0
ERROR: Unhandled exception: <b>TypeError</b>:expected string or buffer

calibre 1.28 [64bit] isfrozen: True is64bit: True
Windows-7-6.1.7601-SP1 Windows ('64bit', 'WindowsPE')
('Windows', '7', '6.1.7601')
Python 2.7.5
Windows: ('7', '6.1.7601', 'SP1', 'Multiprocessor Free')
Traceback (most recent call last):
  File "site-packages\calibre\gui2\tweak_book\boss.py", line 73, in ans
  File "site-packages\calibre\gui2\tweak_book\boss.py", line 1010, in check_requested
  File "site-packages\calibre\gui2\tweak_book\check.py", line 167, in run_checks
  File "site-packages\calibre\ebooks\oeb\polish\check\main.py", line 54, in run_checks
  File "site-packages\calibre\ebooks\oeb\polish\check\parsing.py", line 315, in check_css_parsing
  File "site-packages\cssutils-0.9.10-py2.7.egg\cssutils\parse.py", line 148, in parseString
  File "site-packages\cssutils-0.9.10-py2.7.egg\cssutils\css\cssstylesheet.py", line 355, in _setCssTextWithEncodingOverride
  File "site-packages\cssutils-0.9.10-py2.7.egg\cssutils\css\cssstylesheet.py", line 303, in _setCssText
  File "site-packages\cssutils-0.9.10-py2.7.egg\cssutils\util.py", line 410, in _parse
  File "site-packages\cssutils-0.9.10-py2.7.egg\cssutils\tokenize2.py", line 123, in tokenize
TypeError: expected string or buffer