From 502115eec3dfb022de1387c4895b824b3b284b33 Mon Sep 17 00:00:00 2001 From: vitalii-bezuhlyi Date: Tue, 13 Aug 2024 10:44:57 +0300 Subject: [PATCH] Download project translated files improvements --- Apps.XtrfCustomerPortal/Actions/ProjectActions.cs | 9 +++++---- Apps.XtrfCustomerPortal/Apps.XtrfCustomerPortal.csproj | 6 +++++- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Apps.XtrfCustomerPortal/Actions/ProjectActions.cs b/Apps.XtrfCustomerPortal/Actions/ProjectActions.cs index 20f143e..cebe61c 100644 --- a/Apps.XtrfCustomerPortal/Actions/ProjectActions.cs +++ b/Apps.XtrfCustomerPortal/Actions/ProjectActions.cs @@ -113,18 +113,19 @@ public async Task DownloadProjectFiles( await Client.ExecuteRequestAsync($"/projects/{projectIdentifier.ProjectId}/files", Method.Get, null); var files = taskFilesDto.TasksFiles.SelectMany(x => x.Output?.Files ?? new List()).ToList(); - + var fileReferences = new List(); foreach (var file in files) { - var invoicePdf = await Client.ExecuteRequestAsync($"/projects/files/{file.Id}", Method.Get, null, + var filesResponse = await Client.ExecuteRequestAsync($"/projects/files/{file.Id}", Method.Get, null, "application/octet-stream"); - var rawBytes = invoicePdf.RawBytes!; + var rawBytes = filesResponse.RawBytes!; var stream = new MemoryStream(rawBytes); stream.Position = 0; - var fileReference = await fileManagementClient.UploadAsync(stream, "application/octet-stream", file.Name); + var mimeType = MimeTypes.GetMimeType(file.Name); + var fileReference = await fileManagementClient.UploadAsync(stream, mimeType, file.Name); fileReferences.Add(fileReference); } diff --git a/Apps.XtrfCustomerPortal/Apps.XtrfCustomerPortal.csproj b/Apps.XtrfCustomerPortal/Apps.XtrfCustomerPortal.csproj index 11c87f4..f341abf 100644 --- a/Apps.XtrfCustomerPortal/Apps.XtrfCustomerPortal.csproj +++ b/Apps.XtrfCustomerPortal/Apps.XtrfCustomerPortal.csproj @@ -6,7 +6,7 @@ enable XTRF Customer portal The XTRF Customer Portal is a private website restricted to authorized use for business purposes. It allows clients to access and manage translation project details. Within the portal, clients can view and edit information such as contact details, account manager, pricing, language combinations, and CAT tools used. - 1.0.2 + 1.0.3 Apps.XtrfCustomerPortal Apps.XtrfCustomerPortal @@ -14,6 +14,10 @@ + + all + runtime; build; native; contentfiles; analyzers; buildtransitive +