[web] use `inline` `Content-Disposition` by default (closes #2535734) stable
authorPierre-Yves David <pierre-yves.david@logilab.fr>
Tue, 11 Dec 2012 17:07:57 +0100
branchstable
changeset 8612 3bb96935a6b9
parent 8611 51068fe1e39a
child 8613 9d792e9f1c79
[web] use `inline` `Content-Disposition` by default (closes #2535734) since known time we have been serving static file with a `filename` parameter on the `Content-Disposition` header. But since d74addac92bb we explicitly serve file as attachment if a filename is provided. However this is valid to have `inline` disposition and `filename` parameter. This changeset revert this part of d74addac92bb, going back to `inlined` by default. `IDownloadable` code explicitly request `attachment` content to preserve expected behavior.
web/request.py
web/views/idownloadable.py
--- a/web/request.py	Tue Dec 11 16:57:18 2012 +0100
+++ b/web/request.py	Tue Dec 11 17:07:57 2012 +0100
@@ -611,7 +611,7 @@
         self.set_cookie(name, '', maxage=0, expires=date(2000, 1, 1))
 
     def set_content_type(self, content_type, filename=None, encoding=None,
-                         disposition='attachment'):
+                         disposition='inline'):
         """set output content type for this request. An optional filename
         may be given.
 
--- a/web/views/idownloadable.py	Tue Dec 11 16:57:18 2012 +0100
+++ b/web/views/idownloadable.py	Tue Dec 11 17:07:57 2012 +0100
@@ -100,7 +100,8 @@
             contenttype = adapter.download_content_type()
         self._cw.set_content_type(contenttype or self.content_type,
                                   filename=adapter.download_file_name(),
-                                  encoding=encoding)
+                                  encoding=encoding,
+                                  disposition='attachment')
 
     def call(self):
         entity = self.cw_rset.complete_entity(self.cw_row or 0, self.cw_col or 0)