Skip to content

Commit

Permalink
redirect to download of exported h5p (#2441)
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachughes authored Aug 23, 2023
1 parent 79a25af commit 02f8cd4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

namespace App\Libraries\H5P\Interfaces;

use Symfony\Component\HttpFoundation\StreamedResponse;
use Symfony\Component\HttpFoundation\Response;

interface H5PDownloadInterface
{
public function downloadContent(string $filename, string $title): StreamedResponse;
public function downloadContent(string $filename, string $title): Response;
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
use Exception;
use H5PFileStorage;
use Illuminate\Contracts\Filesystem\Filesystem;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\Log;
use League\Flysystem\FilesystemException;
use League\Flysystem\StorageAttributes;
use Psr\Log\LoggerInterface;
use Symfony\Component\HttpFoundation\StreamedResponse;

class H5PCerpusStorage implements H5PFileStorage, H5PDownloadInterface, CerpusStorageInterface
{
Expand Down Expand Up @@ -537,11 +537,11 @@ public function saveFileFromZip($path, $file, $stream): bool
return $upload;
}

public function downloadContent(string $filename, string $title): StreamedResponse
public function downloadContent(string $filename, string $title): RedirectResponse
{
$path = sprintf(ContentStorageSettings::EXPORT_PATH, $filename);

return $this->filesystem->response($path);
return new RedirectResponse($this->filesystem->url($path));
}

public function getDisplayPath(bool $fullUrl = true)
Expand Down

0 comments on commit 02f8cd4

Please sign in to comment.