Skip to content

Commit 4ac32cb

Browse files
committed
Compatibility with the beta SDK
1 parent 4a66e9b commit 4ac32cb

2 files changed

Lines changed: 12 additions & 4 deletions

File tree

VRChatApiTools/ApiFileAsyncExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static async Task<string> StartSimpleUploadAsync(this ApiFile apiFile,
4242
OnSuccess = c =>
4343
{
4444
wait = false;
45-
uploadUrl = (c as ApiDictContainer)?.ResponseDictionary["url"] as string;
45+
uploadUrl = (c as ApiDictContainer)?.ResponseDictionary["url"].Value as string;
4646
},
4747
OnError = c => throw new Exception(c.Error)
4848
};
@@ -92,7 +92,7 @@ public static async Task<string> StartMultiPartUploadAsync(this ApiFile apiFile,
9292
OnSuccess = c =>
9393
{
9494
wait = false;
95-
uploadUrl = (c as ApiDictContainer)?.ResponseDictionary["url"] as string;
95+
uploadUrl = (c as ApiDictContainer)?.ResponseDictionary["url"].Value as string;
9696
},
9797
OnError = c => throw new Exception("Failed to start multipart upload", new Exception(c.Error))
9898
};

VRChatApiTools/ApiFileHelperAsync.cs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,16 @@ public async Task<string> UploadFile(string filepath, string existingFileId, str
6666
string fileMD5 = await GenerateMD5Base64(filepath, onStatus);
6767

6868
// check if file has been changed
69-
bool isPreviousUploadRetry = await CheckForExistingVersion(onStatus, fileMD5);
70-
69+
bool isPreviousUploadRetry = false;
70+
try
71+
{
72+
isPreviousUploadRetry = await CheckForExistingVersion(onStatus, fileMD5);
73+
}
74+
catch (Exception e)
75+
{
76+
if (e.Message == "The file to upload matches the remote file already.") return apiFile.GetFileURL();
77+
}
78+
7179
//generate file signature
7280
string signatureFilename = await GenerateSignatureFile(filepath, onStatus);
7381

0 commit comments

Comments
 (0)