Small fixes and changes

This commit is contained in:
Natsumi
2023-07-19 11:05:45 +12:00
parent 52b95b16ab
commit 74671a0282
9 changed files with 95 additions and 31 deletions
+19
View File
@@ -174,6 +174,20 @@ namespace VRCX
await requestStream.WriteAsync(endBytes, 0, endBytes.Length);
requestStream.Close();
}
private static async Task UploadFilePut(HttpWebRequest request, IDictionary<string, object> options)
{
request.Method = "PUT";
request.ContentType = options["fileMIME"] as string;
var fileData = options["fileData"] as string;
var sentData = Convert.FromBase64CharArray(fileData.ToCharArray(), 0, fileData.Length);
request.ContentLength = sentData.Length;
using (var sendStream = request.GetRequestStream())
{
await sendStream.WriteAsync(sentData, 0, sentData.Length);
sendStream.Close();
}
}
private static async Task ImageUpload(HttpWebRequest request, IDictionary<string, object> options)
{
@@ -275,6 +289,11 @@ namespace VRCX
{
await ImageUpload(request, options);
}
if (options.TryGetValue("uploadFilePUT", out _))
{
await UploadFilePut(request, options);
}
if (options.TryGetValue("uploadImageLegacy", out _))
{