adobe / aem-core-wcm-components

Standardized components to build websites with AEM.
https://docs.adobe.com/content/help/en/experience-manager-core-components/using/introduction.html
Apache License 2.0
723 stars 737 forks source link

Incorrect file name from Download component for "inline" asset #2751

Open HitmanInWis opened 1 month ago

HitmanInWis commented 1 month ago

Bug present as of version: 2.24.7-SNAPSHOT

If my Download component references a PPTX file (a file my browser doesn't know how to display "inline") but the user selects the "Display inline" option on the dialog anyway, when my browser attempts to open the file and instead downloads it (because it doesnt know how to inline it) I get a filename with the selectors used by the Download servlet: <filename>.pptx.coredownload.inline.pptx. The file instead should download with the same file name as if it was not being inlined - i.e. <filename>.pptx.

Bug file: com.adobe.cq.wcm.core.components.internal.servlets.DownloadServlet

Change the following line:

            response.setHeader(CONTENT_DISPOSITION_HEADER, "inline");

to:

            response.setHeader(CONTENT_DISPOSITION_HEADER, "inline; filename=\"" + filename + "\"");