Forzar descarga de archivos de hoja de cálculo/CSV servidos por token en Myfiles - #2014
Open
abdedarghal111 wants to merge 1 commit into
Open
Forzar descarga de archivos de hoja de cálculo/CSV servidos por token en Myfiles#2014abdedarghal111 wants to merge 1 commit into
abdedarghal111 wants to merge 1 commit into
Conversation
… token MyFilesToken ahora expone shouldForceDownload() para marcar extensiones (csv, ods, xls, xlsx) que deben servirse con Content-Disposition: attachment en lugar de dejar que el navegador decida cómo mostrarlas. Myfiles consulta este método además de su propia lista de extensiones peligrosas.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resumen
Myfilessolo forzabaContent-Disposition: attachmentpara extensiones consideradas peligrosas (svg, xml, html...), dejando que el navegador decidiera cómo mostrar el resto. Esto provoca que archivos como.xlsxo.csvservidos mediante un token deMyFilesTokense abran/previsualicen en el navegador en lugar de descargarse.Cambios
MyFilesToken: nuevo método estáticoshouldForceDownload(string $path): bool, que determina si la extensión del archivo (csv,ods,xls,xlsx) debe forzar la descarga.Myfiles::run(): la condición que decide si enviarContent-Disposition: attachmentahora también consultaMyFilesToken::shouldForceDownload(), además de su propia lista de extensiones peligrosas.