Giter Club home page Giter Club logo

Comments (15)

matthewgoslett avatar matthewgoslett commented on May 24, 2024

It sounds like this is an issue with elFinder? I haven't looked too thoroughly but they don't appear to depend on our package.

from flysystem-google-cloud-storage.

paulcanning avatar paulcanning commented on May 24, 2024

I can edit files on a local file system, just not in GCS, so I'm sure its connected to your package?

from flysystem-google-cloud-storage.

matthewgoslett avatar matthewgoslett commented on May 24, 2024

How are you trying to edit the file(s)?
Can you paste me the sample code?

from flysystem-google-cloud-storage.

paulcanning avatar paulcanning commented on May 24, 2024

I am right clicking and selecting edit file. Code wise, I am using the most basic connector with a GCS adapter and the minimum code for the client.

public function elfinder_init()
    {
        $this->load->helper('path');
        $opts = array(
            'roots' => array(
                array(
                    'driver' => 'LocalFileSystem',
                    'path' => set_realpath('files'),
                    'URL' => base_url('files') . '/'
                ),
                array(
                    'driver' => 'Flysystem',
                    'alias' => 'GCS assets',
                    'URL' => 'https://storage.googleapis.com/assets/',
                    'filesystem' => new Filesystem($this->googleCloud('assets')),
                    'separator' => '/',
                    'defaults' => array('read' => true, 'write' => true)
                ),
            )
        );
        $this->load->library('elfinder_lib', $opts);
    }
<script type="text/javascript" charset="utf-8">
            // Documentation for client options:
            // https://github.com/Studio-42/elFinder/wiki/Client-configuration-options
            $(document).ready(function() {
                $('#elfinder').elfinder({
                    url : '<?php echo site_url('ex_cont/elfinder_init'); ?>'
                });
            });
        </script>

from flysystem-google-cloud-storage.

cedricziel avatar cedricziel commented on May 24, 2024

Yet you're still only showing thirdparty code.

from flysystem-google-cloud-storage.

paulcanning avatar paulcanning commented on May 24, 2024

Because that's all's I'm using...

from flysystem-google-cloud-storage.

cedricziel avatar cedricziel commented on May 24, 2024

But @matthewgoslett has no cigar about elfinder and how it utilizes the driver once created. Can you dig a little deeper on the other side such as checking the correct base - URL for your bucket? Also this example misses what this->googleCloud does.

from flysystem-google-cloud-storage.

paulcanning avatar paulcanning commented on May 24, 2024

OK, I got more information on this. Please see Studio-42/elFinder#1300 for more info, as well as thephpleague/flysystem#627

Basically, you cannot edit a new text file (empty file, 0b) in GCS, as the contents are returned as false, which gets passed through and matched as an error.

If the text file is empty, the content should be returned as such (null or ""?)

Chap from Flysystem has pointed this towards you guys, so can you please investigate?

from flysystem-google-cloud-storage.

paulcanning avatar paulcanning commented on May 24, 2024

Any ideas?

from flysystem-google-cloud-storage.

matthewgoslett avatar matthewgoslett commented on May 24, 2024

I'm busy looking at this now

from flysystem-google-cloud-storage.

matthewgoslett avatar matthewgoslett commented on May 24, 2024

I'm able to replicate this, busy looking at a fix.
The GoogleClient $this->service->objects->get() call returns false when the object is empty (size 0).

from flysystem-google-cloud-storage.

matthewgoslett avatar matthewgoslett commented on May 24, 2024

Thanks for reporting this issue.
It's now fixed in https://github.com/Superbalist/flysystem-google-storage/releases/tag/1.0.3

from flysystem-google-cloud-storage.

paulcanning avatar paulcanning commented on May 24, 2024

Just downloaded 1.0.3 and it doesn't work. Still getting false for an empty text file.

from flysystem-google-cloud-storage.

matthewgoslett avatar matthewgoslett commented on May 24, 2024

I'm unable to replicate this using 1.0.3.

$result = $filesystem->put('blank.txt', '');
var_dump($result); // boolean true

$contents = $filesystem->read('blank.txt');
var_dump($contents); // null

from flysystem-google-cloud-storage.

paulcanning avatar paulcanning commented on May 24, 2024

Well I'm not sure what to tell you, but it is not working for me.

On line 260, $contents doesn't seem to be populated from $this->service->objects->get($this->bucket, $path, ['alt' => 'media']);

Putting a break point on that line, and stepping down to the next line (the IF statement), $contents is not present in my variables list in my IDE.

from flysystem-google-cloud-storage.

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.