Skip to content

Commit

Permalink
Download project translated files improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalii-bezuhlyi committed Aug 13, 2024
1 parent 9934cfc commit 502115e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
9 changes: 5 additions & 4 deletions Apps.XtrfCustomerPortal/Actions/ProjectActions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,19 @@ public async Task<DownloadProjectFilesResponse> DownloadProjectFiles(
await Client.ExecuteRequestAsync<TaskFilesDto>($"/projects/{projectIdentifier.ProjectId}/files", Method.Get,
null);
var files = taskFilesDto.TasksFiles.SelectMany(x => x.Output?.Files ?? new List<TaskFilesDto.File>()).ToList();

var fileReferences = new List<FileReference>();
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);
}

Expand Down
6 changes: 5 additions & 1 deletion Apps.XtrfCustomerPortal/Apps.XtrfCustomerPortal.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,18 @@
<Nullable>enable</Nullable>
<Product>XTRF Customer portal</Product>
<Description>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.</Description>
<Version>1.0.2</Version>
<Version>1.0.3</Version>
<PackageId>Apps.XtrfCustomerPortal</PackageId>
<AssemblyName>Apps.XtrfCustomerPortal</AssemblyName>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Blackbird.Applications.Sdk.Common" Version="2.8.0" />
<PackageReference Include="Blackbird.Applications.Sdk.Utils" Version="1.0.25" />
<PackageReference Include="MimeTypes" Version="2.5.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 502115e

Please sign in to comment.