frankdejonge
Repos
79
Followers
999
Following
15

Abstraction for local and remote filesystems

12642
737

A pragmatic event sourcing library for PHP with a focus on developer experience.

669
66

League\Pipeline

867
73

Event package for your app and domain

1448
41

Events

issue comment
[EXPERIMENT] Public URL generation.

@m-vo that's to ensure the test runs quickly (no network).

Created at 49 minutes ago
issue comment
[EXPERIMENT] Public URL generation.

@m-vo it's the URL that a browser or http client can use to download the file.

Created at 2 hours ago

Remove var_dump import

Created at 3 hours ago

Throw exception when not having a public url configured.

Created at 14 hours ago
pull request opened
[NEW] Public URL generation.
Created at 14 hours ago
create branch
frankdejonge create branch feature/public-url-generation
Created at 14 hours ago
issue comment
phpspec/prophecy is now explicitely needed for tests

The v1 doesn't use latest PHPUnit and v3 doesn't use phpspec. How did you get this error?

Created at 18 hours ago
issue comment
Type Error in FTP Adapter after upgrading to PHP 8.0 (src/Adapter/Ftp.php line 577)

Version 1.1.10 should fix the effect of this.

Created at 18 hours ago
frankdejonge create tag 1.1.10
Created at 1 day ago

Prep changelog

Created at 1 day ago

Fixed type-error when ftp_raw returns false.

Created at 1 day ago
closed issue
Bug when setting a 'root' path in s3 adapter

Description

This issue occurs when using Laravel s3 disk and specifying root path in the config. what happens is when generating a s3 url using the storage facade the end path character "/" is being converted to "%5C" which is the hex ASCII representation of "backslash" . if I remove the root path from the config , then everything works as expected . i saw a couple of people reporting this issue in Laravel but the latter claims that this is not a Laravel issue but a flysystem bug.

How to reproduce

  1. Setup a disk in Laravel config filesystem.php that uses the s3 driver
  2. Define a 'root' key in the filesystem config for that disk
 s3' => [
            'driver' => 's3',
            'key' => env('AWS_ACCESS_KEY_ID'),
            'secret' => env('AWS_SECRET_ACCESS_KEY'),
            'region' => env('AWS_DEFAULT_REGION'),
            'bucket' => env('AWS_BUCKET'),
            'url' => env('AWS_URL'),
            'endpoint' => env('AWS_ENDPOINT'),
            'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false),
            'throw' => false,
            'root' => "tenants/" // when specifying root the issue occurs
        ],
  1. Try to generate an s3 url or temporary url using the Storage facade
Storage::disk("s3")->url("media/1/picture.png");

Expected result

https://bucket-name.s3.amazonaws.com/tenants/media/1/picture.png

Actual results

https://bucket-name.s3.amazonaws.com/tenants%5Cmedia/1/picture.png

Created at 1 day ago
issue comment
Bug when setting a 'root' path in s3 adapter

Please open an issue with Laravel, this functionality is not part of Flysystem.

Created at 1 day ago
closed issue
Type Error in FTP Adapter after upgrading to PHP 8.0 (src/Adapter/Ftp.php line 577)

Bug Report

After updating my project to from PHP 7.4 to PHP 8.0.19 (Laravel 6.x app) the FTP Adapter League\Flysystem\Adapter\Ftp gave the following error:

In Ftp.php line 577:
 implode(): Argument #1 ($pieces) must be of type array, string given

Which leads to the following code:

private function getRawExecResponseCode($command)
{
    $response = @ftp_raw($this->connection, trim($command));

    return (int) preg_replace('/\D/', '', implode(' ', $response)); // <---- line 577; $response is of type `string`
}

Apparently the native ftp_raw method returns a string as return value instead of array|null.

Setting the connection configuration passive = true fixes the issue for now. But this kind of type errors should not occur.

| Q | A |------------ | ------ | BC Break | no | Version | 1.1.9

Summary

The PHP error is resulting in not be able to upload files to a FTP location.

Created at 1 day ago
issue comment
Type Error in FTP Adapter after upgrading to PHP 8.0 (src/Adapter/Ftp.php line 577)

According to the PHP docs, that should not be possible. Perhaps it's a PHP bug? https://www.php.net/manual/en/function.ftp-raw.php

Created at 1 day ago
issue comment
Memory exhausted because of the flysystem cache

V2 and V3 do not have this cache anymore and V1 is in security fix only mode.

Created at 1 day ago
closed issue
Memory exhausted because of the flysystem cache

Bug Report

| Q | A |------------ | ------ | BC Break | no | Version | v1

Summary

Hello, We had an incident where the application ended up in error 500 because of memory exhausted.

We narrowed down the issue to the flysystem cache using Redis: flysystem pushed so many items in this single redis key that it took a lot of memory for PHP to retrieve this object and json_decode it resulting in a memory exhaustion

We have a 196mo memory limit on the prod. Querying that redis key to check for values made our Redis GUI client crash (TablePlus)

Workaround

I'm not looking for a flysystem v1 fix. The immediate fix was to empty this redis entry.

Question

I'm looking to know if this is a behaviour you're aware of and if this has been fixed in v2 or v3 by implementing a cache eviction / cache limit

Example of a value stored inside the cache:

[{"article\/main-picture\/62e2a0f310b0e179632735.png":false,"article\/main-picture":{"path":"article\/main-picture","dirname":"article","basename":"main-picture","filename":"main-picture","type":"dir"},"article":{"path":"article","dirname":"","basename":"article","filename":"article","type":"dir"},"article\/main-picture\/6305f58d4cefa539118766.png":{"path":"article\/main-picture\/6305f58d4cefa539118766.png","dirname":"article\/main-picture","basename":"6305f58d4cefa539118766.png","extension":"png","filename":"6305f58d4cefa539118766","size":216102,"mimetype":"image\/png","type":"file"},"article\/main-picture\/5d526e14bf820589871494.jpg":false,"article\/main-picture\/6305f5a52c514266851611.jpg":{"path":"article\/main-picture\/6305f5a52c514266851611.jpg","dirname":"article\/main-picture","basename":"6305f5a52c514266851611.jpg","extension":"jpg","filename":"6305f5a52c514266851611","size":63520,"mimetype":"image\/jpeg","type":"file"},"sitemap\/en\/articles.cat.news":{"path":"sitemap\/en\/articles.cat.news","dirname":"sitemap\/en","basename":"articles.cat.news","extension":"news","filename":"articles.cat","timestamp":1661334431,"size":1291,"mimetype":"text\/xml","type":"file"},"sitemap\/en":{"path":"sitemap\/en","dirname":"sitemap","basename":"en","filename":"en","type":"dir"},"sitemap":{"path":"sitemap","dirname":"","basename":"sitemap","filename":"sitemap","type":"dir"},"sitemap\/es\/articles.cat.news":{"path":"sitemap\/es\/articles.cat.news","dirname":"sitemap\/es","basename":"articles.cat.news","extension":"news","filename":"articles.cat","timestamp":1661299350,"size":2333,"mimetype":"text\/xml","type":"file"},"sitemap\/es":{"path":"sitemap\/es","dirname":"sitemap","basename":"es","filename":"es","type":"dir"},"sitemap\/it\/articles.dog-cat.news":{"path":"sitemap\/it\/articles.dog-cat.news","dirname":"sitemap\/it","basename":"articles.dog-cat.news","extension":"news","filename":"articles.dog-cat","timestamp":1661299355,"size":2348,"mimetype":"text\/xml","type":"file"},"sitemap\/it":{"path":"sitemap\/it","dirname":"sitemap","basename":"it","filename":"it","type":"dir"},"sitemap\/es\/articles.dog-cat.news":{"path":"sitemap\/es\/articles.dog-cat.news","dirname":"sitemap\/es","basename":"articles.dog-cat.news","extension":"news","filename":"articles.dog-cat","timestamp":1661212944,"size":2473,"mimetype":"text\/xml","type":"file"},"sitemap\/pl\/googleNews":{"path":"sitemap\/pl\/googleNews","dirname":"sitemap\/pl","basename":"googleNews","filename":"googleNews","timestamp":1661334466,"size":10319,"mimetype":"text\/xml","type":"file"},"sitemap\/pl":{"path":"sitemap\/pl","dirname":"sitemap","basename":"pl","filename":"pl","type":"dir"}},[]]
Created at 1 day ago
closed issue
[FTP adapter] LIST command not compatible with latest FileZilla server

Bug Report

Providing options with the FTP LIST command (e.g. LIST -aln /) is not supported any more by the FileZilla server.

I'm not sure if the new behavior is violating any RFCs or if allowing options is actually a non Standard behavior.

My suggestion would be to add an option that disables the usage of LIST options (which seems to fix the issue).

| Q | A |------------ | ------ | BC Break | no | Version | 2.3.2

Summary

Version 1.1.0 of the FileZilla server does not allow arguments in the LIST command any more.

This command works:

LIST /

This fails with 450 - Couldn't open the file

LIST -aln /

How to reproduce

Try listing files with the latest FileZilla server as remote:

// This will always return an empty list with a FileZilla server
// even if there are files / directories in the root directory.
FilesystemOperator::listContents('')

This is the log output of the FileZilla server:

grafik

Hint

It took me a while to figure out the problem because I got a totally unrelated error.

The listContents() call does not throw an Exception, it simply returns an empty list.

But when you upload a file after listing the contents (in the same request) you get an error:

Warning: ftp_fput(): Unable to build data connection: ECONNABORTED - Connection aborted

I hope this helps when someone has a similar issue.

Created at 1 day ago
issue comment
[FTP adapter] LIST command not compatible with latest FileZilla server

Please upgrade to 3.4.0 or above to resolve this issue.

Created at 1 day ago

Bump @types/node from 18.7.23 to 18.8.0

Bumps @types/node from 18.7.23 to 18.8.0.


updated-dependencies:

  • dependency-name: "@types/node" dependency-type: direct:development update-type: version-update:semver-minor ...

Signed-off-by: dependabot[bot] support@github.com

Merge pull request #82 from frankdejonge/dependabot/npm_and_yarn/types/node-18.8.0

Bump @types/node from 18.7.23 to 18.8.0

Created at 1 day ago
Bump @types/node from 18.7.23 to 18.8.0

Bumps @types/node from 18.7.23 to 18.8.0.

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Created at 1 day ago

Bump @actions/github from 5.0.3 to 5.1.1

Bumps @actions/github from 5.0.3 to 5.1.1.


updated-dependencies:

  • dependency-name: "@actions/github" dependency-type: direct:production update-type: version-update:semver-minor ...

Signed-off-by: dependabot[bot] support@github.com

Merge pull request #81 from frankdejonge/dependabot/npm_and_yarn/actions/github-5.1.1

Bump @actions/github from 5.0.3 to 5.1.1

Created at 1 day ago
Bump @actions/github from 5.0.3 to 5.1.1

Bumps @actions/github from 5.0.3 to 5.1.1.

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
Created at 1 day ago
closed issue
Get absolute path using Prefixer

Feature Request

| Q | A |------------ | ------ | New Feature | yes | BC Break | no

Scenario / Use-case

Any time you want the full path to a file; perhaps a log or in my case to match a full path from configured regex like ~/path/to/file_\d{8}.ext~

:memo: Note I understand you I could simply keep track of the base path myself; but in my case that would require either decorating the library, or having 2 pieces of identical configuration which I fear could drift.

:memo: Note 2 Regarding just setting '/' always as the base path: sometimes this isn't possible. Some storage mechanisms may place you in a particular directory when you connect which is why defining a $root is mandatory on some adapters (eg SFTP)

Summary

I understand that for portability reasons we do not want to enforce a Prefixer on all adapters (even though there are currently only 2 that do not use one: InMemory and FTP), but can we at least provide an interface and trait for this to give access to people who want to reference their files by it's instantiated path? It would make future adapters easier with composition and if someone wants to rely on the Prefixer's methods they could typehint the ancillary interface.

Created at 2 days ago
closed issue
S3: add getClient() method to AwsS3V3Adapter

Hello, I think it would be very useful to retrieve the S3 client instance passed to the constructor, so that it could be used to perform operations outside the filesystem. Thanks, Frank

Created at 3 days ago
issue comment
S3: add getClient() method to AwsS3V3Adapter

Flysystem is not a service locator. Either use reflection to get it, or resolve the client from the same place you're getting it from to supply it to the adapter.

Created at 3 days ago