mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-71470 repository_googledocs: Use file name in the source attribute
Instead of using the file title when generating the source attribute, we should be using only the name of the Google Drive file in order to avoid having the original extension within the filename after the file is imported and added into Moodle.
This commit is contained in:
parent
5b315fa595
commit
dbd4620365
1 changed files with 5 additions and 1 deletions
|
@ -31,6 +31,9 @@ class file_node implements node {
|
|||
/** @var string|null The title of the file node. */
|
||||
private $title;
|
||||
|
||||
/** @var string The name of the file. */
|
||||
private $name;
|
||||
|
||||
/** @var string|null The file's export format. */
|
||||
private $exportformat;
|
||||
|
||||
|
@ -54,6 +57,7 @@ class file_node implements node {
|
|||
public function __construct(\stdClass $gdfile) {
|
||||
$this->id = $gdfile->id;
|
||||
$this->title = $this->generate_file_title($gdfile);
|
||||
$this->name = $gdfile->name;
|
||||
$this->exportformat = $this->generate_file_export_format($gdfile);
|
||||
$this->link = $this->generate_file_link($gdfile);
|
||||
$this->modified = ($gdfile->modifiedTime) ? strtotime($gdfile->modifiedTime) : '';
|
||||
|
@ -90,7 +94,7 @@ class file_node implements node {
|
|||
'source' => json_encode(
|
||||
[
|
||||
'id' => $this->id,
|
||||
'name' => $this->title,
|
||||
'name' => $this->name,
|
||||
'link' => $this->link,
|
||||
'exportformat' => $this->exportformat,
|
||||
]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue