Comment 6 for bug 324179

Revision history for this message
paulkoan (c-launchpad-airbred-com) wrote :

The filestore being writeable isn't the issue. There are any number of reasons why a file that ir.attachment expects to be there won't be there. At the heart of the problem is that the ir.attachment gets data from a source external to openerp-server and doesn't check it is valid.

It would be acceptable for this to happen if it just returned an error, but it doesn't - pyPdf will take 100% of the server CPU. In a production environment this would represent openerp in an extremely bad light.

I suggest this simple "fix":

After:

  d = base64.decodestring(pool.get('ir.attachment').browse(cr, uid, aids[0]).datas)

add

  if !d:
    raise FileError, "Attachment not found"

This will at least trigger a traceback and not kill the entire server.