Skip to content

Commit

Permalink
T&A 43220: fix Excel Export by adding file extension (#8732)
Browse files Browse the repository at this point in the history
* fix: add missing file extension when exporting excel file

* refactor: check file extension before writing file
  • Loading branch information
lukas-heinrich authored and kergomard committed Dec 18, 2024
1 parent 02bb888 commit 7ed02c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions components/ILIAS/Test/src/ExportImport/ResultsExportExcel.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,13 @@ public function withUserPages(): self
public function write(): ?string
{
$path = \ilFileUtils::ilTempnam() . $this->filename;

$this->worksheet->setFormat(\ilExcel::FORMAT_XML);
$extension = '.' . strtolower(\ilExcel::FORMAT_XML);
if (!str_ends_with($path, $extension)) {
$path .= $extension;
}

$this->worksheet->writeToFile($path);
return $path;
}
Expand Down

0 comments on commit 7ed02c1

Please sign in to comment.