Skip to content

Commit

Permalink
redirect to download of exported h5p
Browse files Browse the repository at this point in the history
  • Loading branch information
emmachughes committed Aug 23, 2023
1 parent 79a25af commit 4644bf7
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

Check warning on line 540 in sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php

View check run for this annotation

Codecov / codecov/patch

sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php#L540

Added line #L540 was not covered by tests
{
$path = sprintf(ContentStorageSettings::EXPORT_PATH, $filename);

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

Check warning on line 544 in sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php

View check run for this annotation

Codecov / codecov/patch

sourcecode/apis/contentauthor/app/Libraries/H5P/Storage/H5PCerpusStorage.php#L544

Added line #L544 was not covered by tests
}

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

0 comments on commit 4644bf7

Please sign in to comment.