Commits

sempr committed 069849e

MOD: add content-type for others

Comments (0)

Files changed (1)

             the_file = r[0][0]
             suffix = the_file['filename'][-3:].lower()
             if suffix not in set(['png','jpg','gif']):
+                self.set_header("Content-Type", the_file['content_type'])
                 self.set_header('Content-Disposition','attachment; filename=%s'%the_file['filename'])
-                self.set_header('Content-Length', the_file['file_size'])
             else:
                 self.set_header("Content-Type", 'image/%s'%suffix)
+            self.set_header('Content-Length', the_file['file_size'])
             f = open(the_file['file_path'],'rb')
             self.write(f.read())
             f.close()