spatie / laravel-google-cloud-storage

Google Cloud Storage filesystem driver for Laravel
https://spatie.be/open-source
MIT License
196 stars 51 forks source link

Filesystem #4

Closed msalaoniric closed 2 years ago

msalaoniric commented 2 years ago

Is not using the filesystem config properly.... When we set the path_prefix, it's actually ignoring it. Also, when we set the storage_api_url, the bucket url is not correctly formed, as it takes the storage.googleapis.com URL from the images instead of the one we set.

'products' => [
            'driver'                => 'gcs',
            'key_file_path'         => storage_path('xxx_gae.json'),
            'project_id'            => 'xxxxxxxxxxx',
            'bucket'                => 'static.xxxxxxxxx.com',
            'path_prefix'           => 'dev/products',
            'storage_api_uri'       => 'https://static.xxxxxxxxx.com/',
            'visibility'            => 'public'
        ],

And to get the URL Storage::disk('products')->url($this->image)

We are getting: https://storage.googleapis.com/static.xxxxxxxxx.com/<img>

Instead of: https://static.xxxxxxxxx.com/<path_prefix>/<img>

mmachatschek commented 2 years ago

This is the same problem as #3.

I'm working on a fix. You can use root instead of path_prefix which I recommend, as this is the config that Google is actually using.

freekmurze commented 2 years ago

Will be fixed in the next release.