Skip to content

Commit

Permalink
change bits
Browse files Browse the repository at this point in the history
  • Loading branch information
wildman9x committed Apr 19, 2024
1 parent 7ff00dc commit 50cd0db
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions DotnetGRPC/Functions/FileFuncs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public static async Task DownloadAndSaveFile(HttpClient client, string url, stri

contentStream.CopyToAsync(fileStream);
}
else
{
throw new Exception("Failed to download file");
}
}
}
}
3 changes: 2 additions & 1 deletion DotnetGRPC/Services/FileTransferService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ public override async Task<UploadFilesResponse> UploadFiles(UploadFilesRequest r
case ".mkv":
contentType = "video/x-matroska";
break;

// Add more cases as needed
default:
contentType = "application/octet-stream"; // Default to binary data
Expand Down Expand Up @@ -204,6 +204,7 @@ public override async Task DownloadMultipleFileAsZip(

foreach (var url in request.Urls)
{
Console.WriteLine(url);
var uri = new Uri(url);
string[] parts = uri.AbsoluteUri.Split(new[] { Blob.Space }, StringSplitOptions.None);
string fileKey = parts.Length > 2 ? parts[2].TrimStart('/') : "";
Expand Down
5 changes: 3 additions & 2 deletions DotnetGRPCClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
Filename = "file",
Urls =
{
"https://comp1640-blob.sgp1.cdn.digitaloceanspaces.com/comp1640-blob/attachments/13/Will%20AI%20Lead%20To%20The%20End%20Of%20Marketing%20Jobs?.docx",
"https://comp1640-blob.sgp1.cdn.digitaloceanspaces.com/comp1640-blob/attachments/13/image1.webp",
"https://comp1640-blob.sgp1.cdn.digitaloceanspaces.com/comp1640-blob/attachments/21/Screenshot%202024-04-03%20173308.png",
"https://comp1640-blob.sgp1.cdn.digitaloceanspaces.com/comp1640-blob/attachments/21/Screenshot%202024-04-11%20212622.png",
"https://comp1640-blob.sgp1.cdn.digitaloceanspaces.com/comp1640-blob/attachments/21/chap78.docx"
}
};

Expand Down
Binary file removed DotnetGRPCClient/file.zip
Binary file not shown.

0 comments on commit 50cd0db

Please sign in to comment.