|
52 | 52 | 'video/',
|
53 | 53 | )
|
54 | 54 |
|
55 |
| -# Mime types which should be displayed inline in the browser, as opposed to |
56 |
| -# being downloaded. This is used to populate the Content-Disposition header. |
57 |
| -# Only binary MIMEs need to be whitelisted here, since detected non-binary |
58 |
| -# files are always inline. |
59 |
| -INLINE_DISPLAY_MIME_WHITELIST = ( |
60 |
| - 'application/pdf', |
61 |
| - 'audio/', |
62 |
| - 'image/', |
63 |
| - 'video/', |
64 |
| -) |
65 |
| - |
66 | 55 |
|
67 | 56 | install_root = os.path.dirname(__file__)
|
68 | 57 |
|
@@ -290,16 +279,8 @@ async def transfer_file():
|
290 | 279 | # (1) Reasonable-length text: render syntax highlighted in HTML
|
291 | 280 | # (2) Extremely long text: don't render, just show error and offer
|
292 | 281 | # link to the raw file
|
293 |
| - # (3) Binary file that browsers can display (e.g. image): render raw |
294 |
| - # (4) Binary file that browsers cannot display (e.g. tarball): don't |
295 |
| - # render, just show warning and link to the raw file |
296 |
| - # |
297 |
| - # Note that except for images, the file extension isn't too useful to |
298 |
| - # determine the actual content since there are lots of files without |
299 |
| - # extensions (and lots of extensions not recognized by `mimetypes`). |
300 |
| - if mimetype is not None and mimetype.startswith(INLINE_DISPLAY_MIME_WHITELIST): |
301 |
| - # Case 3: render binary |
302 |
| - return _transfer_raw() |
| 282 | + # (3) Binary file: don't render, just show warning and link to the raw |
| 283 | + # file |
303 | 284 |
|
304 | 285 | # Figure out if it looks like text or not.
|
305 | 286 | async with package.open_from_archive(archive_path) as f:
|
@@ -354,7 +335,7 @@ async def transfer_file():
|
354 | 335 | },
|
355 | 336 | )
|
356 | 337 |
|
357 |
| - # Case 4: link to binary |
| 338 | + # Case 3: link to binary |
358 | 339 | return templates.TemplateResponse(
|
359 | 340 | 'package_file_archive_path.html',
|
360 | 341 | {
|
|
0 commit comments