Commit 16dbf2c3 authored by Ivan Tyagov's avatar Ivan Tyagov

If original format is matched or format is empty string return original content of PDF document.

Adjust test accordingly and fix bad test.
parent a4072868
......@@ -95,7 +95,8 @@ class PDFDocument(Image):
data = self._convertToDJVU()
self.setConversion(data, mime=mime, format='djvu')
return (mime, data)
elif format is None:
elif format in ('', None,) or format=='pdf':
# return original content
return self.getContentType(), self.getData()
else:
if kw.get('frame', None) is None:
......
......@@ -2201,9 +2201,13 @@ return 1
self.assertTrue('Content-Length: %s\r\n' %getFileSize('TEST-en-003.odp') in response.info().headers)
response = getURL(pdf_document.absolute_url(), **{'format':''})
self.assertTrue('Content-Type: application/octet-stream\r\n' in response.info().headers)
self.assertTrue('Content-Type: application/pdf\r\n' in response.info().headers)
self.assertTrue('Content-Disposition: attachment; filename="TEST-en-002.pdf"\r\n' in response.info().headers)
response = getURL(pdf_document.absolute_url(), **{'format':'pdf'})
self.assertTrue('Content-Type: application/pdf\r\n' in response.info().headers)
self.assertTrue('Content-Disposition: attachment; filename="TEST-en-002.pdf"\r\n' in response.info().headers)
response = getURL(web_page_document.absolute_url(), **{'format':''})
self.assertTrue('Content-Type: text/html; charset=utf-8\r\n' in response.info().headers)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment