MDL-58535 onedrive: Fix upload to system account

This was failing for personal accounts (but was fine for business).
This commit is contained in:
Damyon Wiese 2017-04-27 14:58:33 +08:00
parent c593a0b001
commit 68c6fd20a7

View File

@ -879,7 +879,9 @@ class repository_onedrive extends repository {
// Upload the file.
$safefilename = clean_param($source->name, PARAM_PATH);
$mimetype = $this->get_mimetype_from_filename($safefilename);
$fileid = $this->upload_file($systemservice, $systemauth, $temppath, $mimetype, $parentid, $safefilename);
// We cannot send authorization headers in the upload or personal microsoft accounts will fail (what a joke!).
$curl = new \curl();
$fileid = $this->upload_file($systemservice, $curl, $temppath, $mimetype, $parentid, $safefilename);
// Read with link.
$this->set_file_sharing_anyone_with_link_can_read($systemservice, $fileid);