nat
(Natalie T)
2 Enero, 2025 17:04
16
Solo una rápida actualización:
La ext_mime_db anterior que usamos sigue los Tipos de Medios IANA definidos aquí: https://www.iana.org/assignments/media-types/media-types.xhtml . Desafortunadamente, esto significa que mp4 es correctamente application/mp4
Aunque, al investigar más a fondo nuestra implementación del cargador S3, veo que estamos agregando la cabecera Content-Disposition "attachment" para casi todas las cargas que no son imágenes, pero parece que solo estaba destinada a agregarse para los SVG. Usar "attachment" haría que el contenido se descargara en lugar de abrirse en una nueva pestaña. Para los videos, es una mezcla de application/video y attachment lo que está causando esto.
Al menos podemos eliminar esta cabecera, creo.
main ← use-inline-no-download
opened 05:01PM - 02 Jan 25 UTC
Back then in https://github.com/discourse/discourse/commit/31e31ef44973dc4daaee2… f010d71588ea5873b53, we added the [Content-Disposition](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Disposition) headers so that SVGs get downloaded instead of get run in the browser. Inadvertently, this also causes other attachments like pdfs and videos to be downloaded instead of heeding the "Open in new tab" option that users choose in the browser.
### Problem video with `Content-Disposition: attachment`:
https://github.com/user-attachments/assets/f05d388f-4454-4615-9d5a-7a0a66fe3b52
When the header is removed, the default value is `"inline"`, this allows the browser to perform as requested. This also applies to other file types like pdfs, allowing users to "Open in new tab" and view them in the browser instead of always downloading them.
Existing tests (https://github.com/discourse/discourse/pull/10205) already do check that SVGs remain downloaded. Some existing tests written for PDFs have been modified to cater for SVGs instead, when there was a bug in defining the filenames per https://github.com/discourse/discourse/pull/10108
2 Me gusta