Skip to content

Commit 1215d7e

Browse files
committed
Fix url generators, calling the filesystem not the adapter adjusted
1 parent 731ab75 commit 1215d7e

File tree

2 files changed

+2
-16
lines changed

2 files changed

+2
-16
lines changed

src/Factory/Uploadable/PublicUrlGenerator.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
namespace Silverback\ApiComponentsBundle\Factory\Uploadable;
1515

16-
use League\Flysystem\Config;
1716
use League\Flysystem\Filesystem;
18-
use League\Flysystem\UrlGeneration\PublicUrlGenerator as FlysystemPublicUrlGenerator;
19-
use Silverback\ApiComponentsBundle\Exception\InvalidArgumentException;
2017

2118
class PublicUrlGenerator implements UploadableUrlGeneratorInterface
2219
{
@@ -26,10 +23,6 @@ public function __construct(private readonly array $config = [])
2623

2724
public function generateUrl(object $object, string $fileProperty, Filesystem $filesystem, string $path): string
2825
{
29-
if (!$filesystem instanceof FlysystemPublicUrlGenerator) {
30-
throw new InvalidArgumentException(sprintf('The public URL generator requires a filesystem implementing %s', FlysystemPublicUrlGenerator::class));
31-
}
32-
33-
return $filesystem->publicUrl($path, new Config($this->config));
26+
return $filesystem->publicUrl($path, $this->config);
3427
}
3528
}

src/Factory/Uploadable/TemporaryUrlGenerator.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@
1313

1414
namespace Silverback\ApiComponentsBundle\Factory\Uploadable;
1515

16-
use League\Flysystem\Config;
1716
use League\Flysystem\Filesystem;
18-
use League\Flysystem\UrlGeneration\TemporaryUrlGenerator as FlysystemTemporaryUrlGenerator;
19-
use Silverback\ApiComponentsBundle\Exception\InvalidArgumentException;
2017

2118
class TemporaryUrlGenerator implements UploadableUrlGeneratorInterface
2219
{
@@ -26,10 +23,6 @@ public function __construct(private readonly array $config = [], private readonl
2623

2724
public function generateUrl(object $object, string $fileProperty, Filesystem $filesystem, string $path): string
2825
{
29-
if (!$filesystem instanceof FlysystemTemporaryUrlGenerator) {
30-
throw new InvalidArgumentException(sprintf('The public URL generator requires a filesystem implementing %s', FlysystemTemporaryUrlGenerator::class));
31-
}
32-
33-
return $filesystem->temporaryUrl($path, new \DateTime($this->expires), new Config($this->config));
26+
return $filesystem->temporaryUrl($path, new \DateTime($this->expires), $this->config);
3427
}
3528
}

0 commit comments

Comments
 (0)