diff --git a/src/MlCli/JobApiCall/ApiCallFiles.cs b/src/MlCli/JobApiCall/ApiCallFiles.cs index 34cb5493..8f2931e7 100644 --- a/src/MlCli/JobApiCall/ApiCallFiles.cs +++ b/src/MlCli/JobApiCall/ApiCallFiles.cs @@ -64,14 +64,14 @@ public async Task ApiCallFilesAsync(string fileName, string json, Callapi inputT { var httpClient = _httpClientFactory.CreateClient(inputTask.Id); - _logger.LogInformation($"Task Id : {inputTask.Id} - Processing {fileName}.json"); + _logger.LogInformation("Task Id : {InputTaskId} - Processing {FileName}.json", inputTask.Id, fileName); var httpResult = JsonConvert.DeserializeObject(json); var correctStatusCode = 200; if (httpResult.StatusCode != correctStatusCode) { - _logger.LogError($"Task Id: {inputTask.Id} - Error: server didn't return 200 status code"); + _logger.LogError("Task Id: {InputTaskId} - Error: server didn\'t return 200 status code", inputTask.Id); return; } @@ -149,10 +149,7 @@ private async Task DownloadFilesAsync(HttpClient httpClient, string fileName, Fi _fileLoader.CreateDirectory(outputPath); - await _fileLoader.WriteAllBytesOfFileAsync(filePath - , - imageBytes - ); + await _fileLoader.WriteAllBytesOfFileAsync(filePath, imageBytes); } } diff --git a/src/MlCli/JobApiCall/Job.cs b/src/MlCli/JobApiCall/Job.cs index 87a95627..08ff71a2 100644 --- a/src/MlCli/JobApiCall/Job.cs +++ b/src/MlCli/JobApiCall/Job.cs @@ -241,7 +241,7 @@ public static string GetTargetFileName(bool isDefaultTargetFileMode, string curr } else { - _logger.LogWarning($"Task Id: {inputTask.Id} - Error : file {settingFile} not found"); + _logger.LogWarning("Task Id: {InputTaskId} - Error : file {SettingFile} not found", inputTask.Id, settingFile); } } } @@ -254,7 +254,7 @@ public static string GetTargetFileName(bool isDefaultTargetFileMode, string curr else { var streamContent = new StreamContent(_fileLoader.OpenRead(file)); - requestContent.Add(streamContent, "file", $"filename{Path.GetExtension(file)}"); + requestContent.Add(streamContent, "file", WebUtility.UrlEncode(fileName)); } request.Content = requestContent;