Update encoding + add from query language

This commit is contained in:
Fransolet Thomas 2023-02-10 17:33:59 +01:00
parent 88ab87c9ee
commit a0b2d5ba9c

View File

@ -260,13 +260,14 @@ namespace ManagerService.Controllers
/// Export a configuration
/// </summary>
/// <param name="id">Id of configuration to export</param>
/// <param name="language">Language to export</param>
[AllowAnonymous]
[ProducesResponseType(typeof(FileContentResult), 200)]
[ProducesResponseType(typeof(string), 400)]
[ProducesResponseType(typeof(string), 404)]
[ProducesResponseType(typeof(string), 500)]
[HttpGet("{id}/export")]
public FileContentResult Export(string id, string language)
public FileContentResult Export(string id, [FromQuery] string language)
{
try
{
@ -387,7 +388,7 @@ namespace ManagerService.Controllers
string jsonString = JsonConvert.SerializeObject(toDownload);
var fileName = $"{configuration.Label}.json";
var mimeType = "application/json";
var fileBytes = Encoding.ASCII.GetBytes(jsonString);
var fileBytes = Encoding.UTF8.GetBytes(jsonString);
return new FileContentResult(fileBytes, mimeType)
{
FileDownloadName = fileName