A client has an existing integration that runs daily, which calls a 3rd-party system to generate a report on new opportunities; the generated report is added to the Oppty as an Attachment, as an HTML document. Previously, clicking the "View" link (e.g., https://c.naXX.content.force.com/servlet/servlet.FileDownload?file=00P1A00000abc01) would display the HTML document in-browser, in a new tab. The client's org received the Spring 16 release over the weekend, and now clicking the "View" link on one of these HTML attachments automatically downloads the file. I do see a response header in the http reply which is likely causing the behavior:

Content-Disposition:attachment; filename="e-renter Report"

While I don't have a captured session from before the release for comparison, I have to believe this is a new behavior.

I've looked through the release notes, and cannot find direct reference to this change. However, there are a number of changes to Attachment support as part of the ongoing Lightning feature rollout, and I'm guessing this is a side effect. There is a new Classic-only setting, "Files uploaded to the Attachments related list on records are uploaded as Salesforce Files, not as attachments", which I have confirmed is not enabled.

The ContentType of theses attachments is 'text/html; charset=UTF-16LE', although I have tested changing one to just 'text/html', which produces the same results.

Is there any documentation of this change? Has anyone else encountered it? Most importantly, is there any way to control which types of attachments cause a direct download? These documents are normally opened using the standard view link in the "Google Docs, Notes, & Attachments" related list on Oppty, so I'm hoping to avoid needing to build a custom "view" solution.

Edit 9 Feb 2016: I've learned that the behavior of file links is configurable in setup on a page titled "File Upload and Download Security". From there, you can choose, for various file types (by extension) the behavior of file links. There are 3 settings: Download forces a download, Execute in Browser opens the file in the Browser, and Hyrbid acts like Execute in Browser for Attachments, but acts like Download for Salesforce Files. I have confirmed that for the org in question, the setting for html files is "Hybrid" (Execute in Browser doesn't appear to be an option for html files). Although I would expect the determination of file type to be based on ContentType, the setup page uses list of file extensions, so I tried adding an explicit .html to the name field of one of the attachments, and have confirmed that it still doesn't work as expected.

  • I just tried this on both na5 (currently Winter 16) and gs0 (Spring 16). With an HTML attachment on an opportunity the FileDownload servlet causes the file to download in Chrome. That doesn't occur for a JPEG. – Daniel Ballinger Feb 8 '16 at 23:59
  • 1
    @DanielBallinger Thanks for testing that. I've added some info to my question; turns out there's a Setup option to control the behavior of file links; I've confirmed that my org is configured correctly but the links aren't working as expected. It's possible your test orgs are configured for Download always. We've opened a case with SFDC; I'll update if we learn anything. – Jason Clark Feb 9 '16 at 16:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.