Code Monkey home page Code Monkey logo

Comments (4)

martyf avatar martyf commented on June 9, 2024

The issue also exists with the copy function when used with R2, with $visibility being null, and throwing League\Flysystem\UnableToRetrieveMetadata, where GetObjectAcl not implemented appears too.

Storage::disk('r2')->copy($sourcePath, $targetPath);

Will run this code:

public function copy(string $source, string $destination, Config $config): void
    {
        try {
            $visibility = $config->get(Config::OPTION_VISIBILITY);

            if ($visibility === null && $config->get(Config::OPTION_RETAIN_VISIBILITY, true)) {
                $visibility = $this->visibility($source)->visibility();
            }
        } catch (Throwable $exception) {
            throw UnableToCopyFile::fromLocationTo(
                $source,
                $destination,
                $exception
            );
        }
    // ...

This is where the exception is caught. $visibility will be null, then the exception thrown.

My disk setup is like yours: visibility set to private.

Downgrading to 3.15 does not resolve it for me though.

from flysystem.

it-can avatar it-can commented on June 9, 2024

Did any of you guys find a solution for the problem? Move (and copy) seems not to be working on r2

from flysystem.

it-can avatar it-can commented on June 9, 2024

this seems related: #1791

from flysystem.

it-can avatar it-can commented on June 9, 2024

it seems the config is not passed down to the copy() function

$config = new Config([
    Config::OPTION_VISIBILITY => 'private',
]);

Storage::disk('r2')->move($orgFile, $archiveFile, $config);

when i debug this with ray(), i see the config object is not the same

Scherm­afbeelding 2024-05-06 om 17 06 38

So it seems the Laravel Disk/storage config is not passed correctly, so it tries to fetch the visibility from the file (GetObjectACL is not supported by Cloudflare R2), so it will throw an Exception.

It seems the the laravel disk config is not passed correctly to AwsS3V3Adapter.

--

UPDATE
when i manually comment out this part of the code:

try {
            $visibility = $config->get(Config::OPTION_VISIBILITY);

            if ($visibility === null && $config->get(Config::OPTION_RETAIN_VISIBILITY, true)) {
                $visibility = $this->visibility($source)->visibility();
            }
        } catch (Throwable $exception) {
            throw UnableToCopyFile::fromLocationTo(
                $source,
                $destination,
                $exception
            );
        }

and then add

$visibility = 'private';

the "moving/copying" of the file works...

from flysystem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.