CoastalResilienceNetwork / GeositeFramework

Mapping Framework powering TNC Coastal Resilience programs
http://maps.coastalresilience.org/network/
GNU General Public License v3.0
13 stars 10 forks source link

Use json file extension for translation files #1165

Closed caseycesari closed 5 years ago

caseycesari commented 5 years ago

Overview

The previous implementation used a dynamic endpoint to serve the translation file, which didn't have a file extension. When we initially migrated the translation backend to the static build, we left the file without an extension. This worked for most installations, but proved to be problematic when serving the app from IIS, which uses a whitelist for serving file extensions. Adding the json file extension also makes more practical sense than using no extension since the file is indeed JSON.

Connects #1163

Testing Instructions

mmcfarland commented 5 years ago

Both branches fail for me in the same way, which is that json isn't a MIME type that IIS will serve

screenshot from 2018-12-19 15 01 17

HTTP Error 404.3 - Not Found
The page you are requesting cannot be served because of the extension configuration. If the page is a script, add a handler. If the file should be downloaded, add a MIME map.

Typically we fix this by adding a web.config that removes/adds the *.json extension as a valid MIME type.

However, if their server has already manually been configured to serve *.json, the code looks like it'd work - however, building with the syntax

python build.py dr-region --region-branch transition --framework-branch cpc/fix-translation

still produces language files without the file extension.

screenshot from 2018-12-19 15 05 32

caseycesari commented 5 years ago

Thanks!