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

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

FIX: Always setting public files to true #170

Closed Blagoj5 closed 1 year ago

Blagoj5 commented 1 year ago

Problem

There is currently a bug in the code especially on line 46 where publicFIles is always true, e.g

config.publicFiles = false || true; // ALWAYS: true
config.publicFiles = true || true; // ALWAYS: true
config.publicFiles = eval('something else') || true; // throws an error and it was not handled

Solution

Make sure we do proper checking with the new util function setConfigField in case if the config value is string, undefined or an actual boolean. I didn't see a reason to really add tests for this, but if you guys want to do this, I can take care of it.

Blagoj5 commented 1 year ago

I can't really tag reviewers, so I'll ping with this comment @Lith @dgmike :sweat_smile:

codecov-commenter commented 1 year ago

Codecov Report

Patch coverage: 54.54% and project coverage change: -3.04 :warning:

Comparison is base (b5fa17e) 81.48% compared to head (067688b) 78.44%.

:exclamation: Current head 067688b differs from pull request most recent head 6f47e5e. Consider uploading reports for the commit 6f47e5e to get more accurate results

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #170 +/- ## ========================================== - Coverage 81.48% 78.44% -3.04% ========================================== Files 2 2 Lines 108 116 +8 ========================================== + Hits 88 91 +3 - Misses 20 25 +5 ``` | [Impacted Files](https://app.codecov.io/gh/strapi-community/strapi-provider-upload-google-cloud-storage/pull/170?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=strapi-community) | Coverage Δ | | |---|---|---| | [lib/provider.js](https://app.codecov.io/gh/strapi-community/strapi-provider-upload-google-cloud-storage/pull/170?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=strapi-community#diff-bGliL3Byb3ZpZGVyLmpz) | `78.07% <54.54%> (-3.07%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

Lith commented 1 year ago

Thanks @Blagoj5 ! Could you please signing your commits ? I'm unable to merge without it :/

Blagoj5 commented 1 year ago

It should be signed now, tell me if you have any problems. I wasn't aware this was an requirement sorry. @Lith