Skip to content

Commit

Permalink
MDL-28666, Fixed source field when download a file using filepicker
Browse files Browse the repository at this point in the history
  • Loading branch information
Dongsheng Cai authored and marinaglancy committed May 21, 2012
1 parent 0f0d10c commit 4712676
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions repository/repository_ajax.php
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,18 @@
}

// Check if exceed maxbytes.
if (($maxbytes!==-1) && (filesize($file['path']) > $maxbytes)) {
if (($maxbytes!==-1) && (filesize($downloadedfile['path']) > $maxbytes)) {
throw new file_exception('maxbytes');
}

$record->source = !empty($downloadedfile['url']) ? $downloadedfile['url'] : '';
// {@link file_restore_source_field_from_draft_file()}
$sourcefield = '';
if (!empty($downloadedfile['url'])) {
$source = new stdClass;
$source->source = $downloadedfile['url'];
$sourcefield = serialize($source);
}
$record->source = $sourcefield;

$info = repository::move_to_filepool($downloadedfile['path'], $record);
if (empty($info)) {
Expand Down

0 comments on commit 4712676

Please sign in to comment.