cloudinary / cloudinary_js

Cloudinary JavaScript library
MIT License
328 stars 224 forks source link

userAgent Bug #281

Closed echatzief closed 2 years ago

echatzief commented 2 years ago

Brief Summary of Changes

What does this PR address?

Are tests included?

Reviewer, Please Note:

patrick-tolosa commented 2 years ago

Hey @echatzief - What bug does this PR fix?

echatzief commented 2 years ago

Hey @echatzief - What bug does this PR fix?

The module is used at the strapi-provider-upload-cloudinary and the navigator is globally defined. Thus, using the library with node.js the navigator breaks (because it's not defined) and throws error to the above plugin. So, you must define the userAgent inside each function not globally.

patrick-tolosa commented 2 years ago

Thanks, sounds like the right approach.

We'd like to avoid this code duplication though, can you please move the navigator line to a function? getNavigator() (or any other suitable name) instead of copy pasting this line over and over.

patrick-tolosa commented 2 years ago

Almost done here, please move it to the top of the file and we're good to merge.