Fix Google Drive uploader null response fields

args go in the multi-part form, not the url
This commit is contained in:
SupSuper 2020-06-10 23:10:10 +01:00
parent be9a529af5
commit a5b2712495

View file

@ -253,16 +253,8 @@ public override UploadResult Upload(Stream stream, string fileName)
string metadata = GetMetadata(fileName, FolderID, DriveID);
Dictionary<string, string> args = new Dictionary<string, string>();
args.Add("uploadType", "multipart");
args.Add("fields", "id,webViewLink,webContentLink");
if (!string.IsNullOrEmpty(DriveID))
{
args.Add("supportsAllDrives", "true");
}
UploadResult result = SendRequestFile("https://www.googleapis.com/upload/drive/v3/files", stream, fileName, "file", args,
GoogleAuth.GetAuthHeaders(), contentType: "multipart/related", relatedData: metadata);
UploadResult result = SendRequestFile("https://www.googleapis.com/upload/drive/v3/files?uploadType=multipart&fields=id,webViewLink,webContentLink&supportsAllDrives=true",
stream, fileName, "file", headers: GoogleAuth.GetAuthHeaders(), contentType: "multipart/related", relatedData: metadata);
if (!string.IsNullOrEmpty(result.Response))
{