Skip to content

Commit

Permalink
Remove file format restriction
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed May 2, 2024
1 parent 1f8bee3 commit 5a8671c
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
4 changes: 0 additions & 4 deletions src/Thumbnail/FileThumbnail.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ public function __construct(private Packages $packages)

public function generatePublicUrl(MediaProviderInterface $provider, MediaInterface $media, string $format): string
{
if (MediaProviderInterface::FORMAT_ADMIN !== $format) {
throw new \InvalidArgumentException(sprintf('Unsupported format "%s".', $format));
}

return $this->packages->getUrl('bundles/sonatamedia/file.png');
}

Expand Down
7 changes: 3 additions & 4 deletions tests/Thumbnail/FileThumbnailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Sonata\MediaBundle\Tests\Security;
namespace Sonata\MediaBundle\Tests\Thumbnail;

use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;
Expand Down Expand Up @@ -47,10 +47,9 @@ public function testGeneratePublicUrl(): void

static::assertSame('bundles/sonatamedia/file.png', $publicUrl);

$this->expectException(\InvalidArgumentException::class);
$this->expectExceptionMessage('Unsupported format "random".');
$publicUrl = $this->thumbnail->generatePublicUrl($provider, $media, 'random');

$this->thumbnail->generatePublicUrl($provider, $media, 'random');
static::assertSame('bundles/sonatamedia/file.png', $publicUrl);
}

public function testGeneratePrivateUrl(): void
Expand Down
2 changes: 1 addition & 1 deletion tests/Thumbnail/FormatThumbnailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Sonata\MediaBundle\Tests\Security;
namespace Sonata\MediaBundle\Tests\Thumbnail;

use Gaufrette\Adapter\InMemory;
use Gaufrette\File;
Expand Down
2 changes: 1 addition & 1 deletion tests/Thumbnail/LiipImagineThumbnailTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
* file that was distributed with this source code.
*/

namespace Sonata\MediaBundle\Tests\Security;
namespace Sonata\MediaBundle\Tests\Thumbnail;

use Gaufrette\Adapter\InMemory;
use Gaufrette\File;
Expand Down

0 comments on commit 5a8671c

Please sign in to comment.