diff --git a/lib/Controller/ExportController.php b/lib/Controller/ExportController.php index f39655b..e7c7af1 100644 --- a/lib/Controller/ExportController.php +++ b/lib/Controller/ExportController.php @@ -27,7 +27,8 @@ use OC; use OCA\Radio\AppInfo\Application; use OCA\Radio\Service\FavoriteService; use OCP\AppFramework\Controller; -use OCP\AppFramework\Http\DataResponse; +use OCP\AppFramework\Http\DataResponse; // FIXME: Remove if not required +use OCP\AppFramework\Http\Response; use OCP\IRequest; use SimpleXMLElement; @@ -51,8 +52,9 @@ class ExportController extends Controller { /** * @NoAdminRequired */ - public function index() { - $xml = new SimpleXMLElement(''); + public function index(): Response { + $xml = new SimpleXMLElement(''); + $xml->addAttribute('encoding', 'UTF-8'); $trackList = $xml->addChild('trackList'); $track = $trackList->addChild('track'); $track->addChild('location', 'http://localhost/test.mp3'); @@ -73,7 +75,8 @@ class ExportController extends Controller { header('Content-Type: application/xspf+xml'); header('Content-Disposition: attachment; filename=' . $export_name); //return new DataResponse($this->service->findAll($this->userId)); - return $xml->asXML(); + return new Response($xml->asXML()); + //return $xml->asXML(); } }