Merge branch 'MDL-33174-master' of https://github.com/matt-catalyst/moodle
This commit is contained in:
@@ -362,7 +362,7 @@ abstract class file_system {
|
||||
public function add_to_curl_request(stored_file $file, &$curlrequest, $key) {
|
||||
// Note: curl_file_create does not work with remote paths.
|
||||
$path = $this->get_local_path_from_storedfile($file, true);
|
||||
$curlrequest->_tmp_file_post_params[$key] = curl_file_create($path);
|
||||
$curlrequest->_tmp_file_post_params[$key] = curl_file_create($path, null, $file->get_filename());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -545,6 +545,29 @@ class core_filelib_testcase extends advanced_testcase {
|
||||
$this->assertSame('OK', $contents);
|
||||
}
|
||||
|
||||
public function test_curl_file_name() {
|
||||
$this->resetAfterTest();
|
||||
$testurl = $this->getExternalTestFileUrl('/test_file_name.php');
|
||||
|
||||
$fs = get_file_storage();
|
||||
$filerecord = array(
|
||||
'contextid' => context_system::instance()->id,
|
||||
'component' => 'test',
|
||||
'filearea' => 'curl_post',
|
||||
'itemid' => 0,
|
||||
'filepath' => '/',
|
||||
'filename' => 'test.txt'
|
||||
);
|
||||
$teststring = 'moodletest';
|
||||
$testfile = $fs->create_file_from_string($filerecord, $teststring);
|
||||
|
||||
// Test post with file.
|
||||
$data = array('testfile' => $testfile);
|
||||
$curl = new curl();
|
||||
$contents = $curl->post($testurl, $data);
|
||||
$this->assertSame('OK', $contents);
|
||||
}
|
||||
|
||||
public function test_curl_protocols() {
|
||||
|
||||
// HTTP and HTTPS requests were verified in previous requests. Now check
|
||||
|
||||
@@ -46,6 +46,7 @@ information provided here is intended especially for developers.
|
||||
update to use the ModalEvents.save and ModalEvents.cancel events instead of their yes/no counterparts.
|
||||
* Instead of checking the 'moodle/course:viewparticipants' and 'moodle/site:viewparticipants' capabilities use the
|
||||
new functions course_can_view_participants() and course_require_view_participants().
|
||||
* $stored_file->add_to_curl_request() now adds the filename to the curl request.
|
||||
|
||||
=== 3.3.1 ===
|
||||
|
||||
|
||||
Reference in New Issue
Block a user