Update encoding + add from query language
This commit is contained in:
parent
88ab87c9ee
commit
a0b2d5ba9c
@ -260,13 +260,14 @@ namespace ManagerService.Controllers
|
|||||||
/// Export a configuration
|
/// Export a configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="id">Id of configuration to export</param>
|
/// <param name="id">Id of configuration to export</param>
|
||||||
|
/// <param name="language">Language to export</param>
|
||||||
[AllowAnonymous]
|
[AllowAnonymous]
|
||||||
[ProducesResponseType(typeof(FileContentResult), 200)]
|
[ProducesResponseType(typeof(FileContentResult), 200)]
|
||||||
[ProducesResponseType(typeof(string), 400)]
|
[ProducesResponseType(typeof(string), 400)]
|
||||||
[ProducesResponseType(typeof(string), 404)]
|
[ProducesResponseType(typeof(string), 404)]
|
||||||
[ProducesResponseType(typeof(string), 500)]
|
[ProducesResponseType(typeof(string), 500)]
|
||||||
[HttpGet("{id}/export")]
|
[HttpGet("{id}/export")]
|
||||||
public FileContentResult Export(string id, string language)
|
public FileContentResult Export(string id, [FromQuery] string language)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -387,7 +388,7 @@ namespace ManagerService.Controllers
|
|||||||
string jsonString = JsonConvert.SerializeObject(toDownload);
|
string jsonString = JsonConvert.SerializeObject(toDownload);
|
||||||
var fileName = $"{configuration.Label}.json";
|
var fileName = $"{configuration.Label}.json";
|
||||||
var mimeType = "application/json";
|
var mimeType = "application/json";
|
||||||
var fileBytes = Encoding.ASCII.GetBytes(jsonString);
|
var fileBytes = Encoding.UTF8.GetBytes(jsonString);
|
||||||
return new FileContentResult(fileBytes, mimeType)
|
return new FileContentResult(fileBytes, mimeType)
|
||||||
{
|
{
|
||||||
FileDownloadName = fileName
|
FileDownloadName = fileName
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user