dansmith65

Can't download a .fmp12 file from a container via XML CWP on FMS16

Discussion created by dansmith65 on Aug 22, 2017
Latest reply on Aug 25, 2017 by TSGal

Product and version FileMaker Server 16 (might also affect 15; not sure)

OS and version Windows 2016 (probably affects Mac server's too)

Browser and version Chrome, IE, Edge (all current-ish)

Description

If you click a link to download a FileMaker Pro file, stored in a container field, via xml custom web publishing, it will display gibberish-looking text instead of downloading the file.

 

How to replicate

  1. Host a file named testabug.fmp12 on FMS16
    1. With layout named: test
    2. and a field named: container
      1. where the record with internal id 1 has a file named test.fmp12 stored in this field
  2. Enable XML CWP
  3. Type this is one of the browsers listed above: http://127.0.0.1/fmi/xml/cnt/test.fmp12?-db=testabug&-lay=test&-recid=1&-field=container(1)
  4. Enjoy the gibberish text

 

Workaround

Add the following lines to this file (right before </web-app> at the end)

    C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\jwpc-tomcat\fmi\WEB-INF\web.xml

<mime-mapping>
    <extension>fmp12</extension>
    <mime-type>application/x-filemaker</mime-type>
</mime-mapping>

 

The reason this is an issue is because a new header was recently added to the web publishing engines response header: html - What is "X-Content-Type-Options=nosniff"? - Stack Overflow. In FMS14, this wasn't necessary because that header parameter didn't exist so most browsers determined that the file should be downloaded instead of displayed. Now that the option has been disabled, any file extension not specifically listed in one of tomcat's config files will be displayed with the default content-type, which is text... Unless your browser ignores that response header (yeah, I'm looking at you Saffari).

Note: the other tomcat config file (which the above code could be added to instead) is located at:

   C:\Program Files\FileMaker\FileMaker Server\Web Publishing\publishing-engine\jwpc-tomcat\conf\web.xml

Outcomes