strapi-community / strapi-provider-upload-google-cloud-storage

Google Cloud Storage Upload Provider for Strapi
MIT License
211 stars 94 forks source link

No previews for private files #169

Closed kashkashio closed 1 year ago

kashkashio commented 1 year ago

Describe the bug The plugin in its latest version, take the environment variables Booleans as strings hence breaking the logic for the boolean flags

To Reproduce Steps to reproduce the behavior:

  1. put a breakpoint in the node_modules provider.js file in the package folder every where basically and you will see that the flags are always true because conditions are checking !boolean on string wich always returns true.

Expected behavior boolean should remain boolean and not be parsed as string.

Screenshots I had to duplicate the plugin and run it locally and push this fix which is not the best one but it is workaround that works for me.

Screenshot 2023-04-30 at 15 44 45

Desktop (please complete the following information):

Additional context Should be addressed because this can cause a lot confusion and burn time because this all provider thing is complicated enough with many moving parts starting from google cloud, bucket, service account etc. i mean there can be enough failure points and caveats so we should try and make sure we help the devs :)

Also I would suggest to add more flags to the return signed URL method like the cname or virtually control as can be seen here: https://googleapis.dev/nodejs/storage/latest/Bucket.html#getSignedUrl

And also make sure you mention that the dev needs to give the service account this role: gcloud projects add-iam-policy-binding PROJECT_ID --member=serviceAccount:ACCOUNT_EMAIL --role=roles/iam.serviceAccountTokenCreator

Because without that the app wont be able to sign those urls.

Lith commented 1 year ago

Hi,

Seems this issue relate to PR https://github.com/strapi-community/strapi-provider-upload-google-cloud-storage/pull/165 from @Marc-Roig

I will try to improve documentation and feature, but if someone else has more time to do that ? :)

Thanks,

Marc-Roig commented 1 year ago

Also I would suggest to add more flags to the return signed URL method like the cname or virtually control as can be seen here:

Curious about the use case here, it would be useful to return the cname of the bucket when signing a URL? How would you use this data?

Lith commented 1 year ago

I will push a new release code today with a quick fix for your problem, not sure eval are the best solution... but I've no time to find something better 🤣

Please try the latest release : 4.10.2 and tell me if it's working fine !!

Thanks 👍

Lith commented 1 year ago

https://github.com/strapi-community/strapi-provider-upload-google-cloud-storage/releases/tag/4.10.2