##// END OF EJS Templates
set default mimetype to octet-stream for binary files...
Min RK -
Show More
@@ -268,7 +268,6 b' class FileContentsManager(ContentsManager):'
268 model['type'] = 'file'
268 model['type'] = 'file'
269
269
270 os_path = self._get_os_path(path)
270 os_path = self._get_os_path(path)
271 model['mimetype'] = mimetypes.guess_type(os_path)[0] or 'text/plain'
272
271
273 if content:
272 if content:
274 if not os.path.isfile(os_path):
273 if not os.path.isfile(os_path):
@@ -285,10 +284,14 b' class FileContentsManager(ContentsManager):'
285 raise web.HTTPError(400, "%s is not UTF-8 encoded" % path)
284 raise web.HTTPError(400, "%s is not UTF-8 encoded" % path)
286 else:
285 else:
287 model['format'] = 'text'
286 model['format'] = 'text'
287 default_mime = 'text/plain'
288
288
289 if model['content'] is None:
289 if model['content'] is None:
290 model['content'] = base64.encodestring(bcontent).decode('ascii')
290 model['content'] = base64.encodestring(bcontent).decode('ascii')
291 model['format'] = 'base64'
291 model['format'] = 'base64'
292 default_mime = 'application/octet-stream'
293
294 model['mimetype'] = mimetypes.guess_type(os_path)[0] or default_mime
292
295
293 return model
296 return model
294
297
General Comments 0
You need to be logged in to leave comments. Login now