nao-pon/flysystem-google-drive

Visibility Of Uploaded File

achatzi78 opened this issue · 1 comments

Hi.

I have a question, whenever I upload a file another request is made to change the visibility to anyone.

How can I upload files and not change visibility? I want the files to be accessible only from me. Also, this creates issues with the request rate limit, so I would like to avoid the additional request.

I tried to change the publishPermission to

'publishPermission' => [
    'type' => 'user',
    'emailAddress' => 'myemail@gmail.com'
]

but this also makes another request and additionally it sends an email notification (which I cannot disable) which creates issues with the limits as well.

Also, I changed the visibility setting in the filesystem config (I am using Laravel)

'google' => [
    'driver' => 'google',
    'clientId' => env('GOOGLE_DRIVE_CLIENT_ID', ''),
    'clientSecret' => env('GOOGLE_DRIVE_CLIENT_SECRET', ''),
    'refreshToken' => env('GOOGLE_DRIVE_REFRESH_TOKEN', ''),
    'folderId' => env('GOOGLE_DRIVE_FOLDER_ID', ''),
    'visibility' => 'private',
],

but this did not work as well.

Any help would be appreciated.

Thanks

You can you setVisibility method. But don't call $storage->url() because this method will publish your file again.

 $storage->setVisibility($filePath, AdapterInterface::VISIBILITY_PRIVATE);