Show More
@@ -268,7 +268,6 b' class FileContentsManager(ContentsManager):' | |||
|
268 | 268 | model['type'] = 'file' |
|
269 | 269 | |
|
270 | 270 | os_path = self._get_os_path(path) |
|
271 | model['mimetype'] = mimetypes.guess_type(os_path)[0] or 'text/plain' | |
|
272 | 271 | |
|
273 | 272 | if content: |
|
274 | 273 | if not os.path.isfile(os_path): |
@@ -285,10 +284,14 b' class FileContentsManager(ContentsManager):' | |||
|
285 | 284 | raise web.HTTPError(400, "%s is not UTF-8 encoded" % path) |
|
286 | 285 | else: |
|
287 | 286 | model['format'] = 'text' |
|
287 | default_mime = 'text/plain' | |
|
288 | 288 | |
|
289 | 289 | if model['content'] is None: |
|
290 | 290 | model['content'] = base64.encodestring(bcontent).decode('ascii') |
|
291 | 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 | 296 | return model |
|
294 | 297 |
General Comments 0
You need to be logged in to leave comments.
Login now