Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't generate temporary URL using InMemoryFilesystemAdapter #287

Open
juanwilde opened this issue Sep 18, 2023 · 0 comments
Open

Can't generate temporary URL using InMemoryFilesystemAdapter #287

juanwilde opened this issue Sep 18, 2023 · 0 comments

Comments

@juanwilde
Copy link

Bug Report

Q A
BC Break yes
Version 4.9.0

Summary

I am using the InMemoryFilesystemAdapter to test some parts of my application, so I added this configuration

// config/packages/test/filesystem.yaml

oneup_flysystem:
  filesystems:
    default_filesystem:
      adapter: memory_adapter
  adapters:
    memory_adapter:
      memory: ~

At some point in my use case I need to call a method to generate a temporary URL

$this->filesystem->temporaryUrl($path, $expirationDate);

Inside that method there is a condition to check if the generator is an instance of TemporaryUrlGenerator

    public function temporaryUrl(string $path, DateTimeInterface $expiresAt, array $config = []): string
    {
        $generator = $this->temporaryUrlGenerator ?: $this->adapter;

        if ($generator instanceof TemporaryUrlGenerator) {
            return $generator->temporaryUrl($path, $expiresAt, $this->config->extend($config));
        }

        throw UnableToGenerateTemporaryUrl::noGeneratorConfigured($path);
    }

And here is where it fails.

How to reproduce

In a Symfony 5.4 project install the following dependencies

"oneup/flysystem-bundle": "^4.8",
"league/flysystem-google-cloud-storage": "^3.15",
"league/flysystem-memory": "^3.0",
  • Create a test extending KernelTestCase
  • Create a class or use case that calls League\Flysystem\Filesystem::temporaryUrl
  • It will throw League\Flysystem\UnableToGenerateTemporaryUrl: "Unable to generate temporary url for 7f736383-dcb8-47db-bd17-888b75ac9481/export_2023-09-18_09-29-05.xlsx: No generator was configured "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant