cloudinary / cloudinary-cli

A command line interface for Cloudinary's APIs
https://cloudinary.com/documentation/cloudinary_cli
MIT License
17 stars 10 forks source link

Cloudinary Test Cloud returns invalid Public IDs #65

Open chrissnyder2337 opened 1 year ago

chrissnyder2337 commented 1 year ago

Bug report for Cloudinary CLI

This is not necessarily an issue with the Cloudinary CLI itself, but with the test cloud it runs against.

Describe the bug in a sentence or two.

I found that the Test cloud returns invalid/inconsistent public ids for assets, especially when compared to running the same commands against a real Cloudinary account/enviroment. This impacts the ability to write accurate tests. I experienced this while trying to write tests for #63 .

Issue Type (Can be multiple)

Steps to reproduce

  1. Run the test_cli_upload_dir command using the test Cloudinary environment (provided by running ./tools/get_test_cloud.sh). Note the command's output (by dumping/inspecting output.result).:
Uploading directory '/Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync'
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/(02)-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-(2.3.2)_378x150_98x63.jpg as test_upload_dir_10966/test_sync/(02)-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-(2.3.2)_378x150_98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/Ek_Bremen_P+R Syke_200x200.jpg as test_upload_dir_10966/test_sync/Ek_Bremen_P+R Syke_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/NoSpaces/OrdinaryFilename.png as test_upload_dir_10966/test_sync/NoSpaces/OrdinaryFilename
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/Philips Lifetime_200x150.jpg as test_upload_dir_10966/test_sync/Philips Lifetime_200x150
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/SomeName/(02)-some-real_File-Name-Zone-(2.3.2)_378x150_98x63.jpg as test_upload_dir_10966/test_sync/SomeName/(02)-some-real_File-Name-Zone-(2.3.2)_378x150_98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/Speed_Grip 3_05_200x200.jpg as test_upload_dir_10966/test_sync/Speed_Grip 3_05_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/hymer-1-2_)_98x63.jpg as test_upload_dir_10966/test_sync/hymer-1-2_)_98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/specialCharactersätstest_1234/Einzelkritiken/(02)-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-(2.3.2)_378x150_98x63.jpg as test_upload_dir_10966/test_sync/specialCharactersätstest_1234/Einzelkritiken/(02)-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-(2.3.2)_378x150_98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/test with spaces/test_space 3_05_200x200.jpg as test_upload_dir_10966/test_sync/test with spaces/test_space 3_05_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/test-h7/Philips Lifetime_200x150.jpg as test_upload_dir_10966/test_sync/test-h7/Philips Lifetime_200x150
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/test_underscores____test/Ek_Bremen_P+R Syke_200x200.jpg as test_upload_dir_10966/test_sync/test_underscores____test/Ek_Bremen_P+R Syke_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/wohnmobil-2010/hymer-1-2_)_98x63.jpg as test_upload_dir_10966/test_sync/wohnmobil-2010/hymer-1-2_)_98x63
/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py:265: ResourceWarning: unclosed running multiprocessing pool <multiprocessing.pool.ThreadPool state=RUN pool_size=30>
  _warn(f"unclosed running multiprocessing pool {self!r}",
ResourceWarning: Enable tracemalloc to get the object allocation traceback
12 resources uploaded
  1. Run the same test_cli_upload_dir command using a real Cloudinary environment (from https://cloudinary.com/console). Note the command's output (by dumping/inspecting output.result).:
Uploading directory '/Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync'
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/(02)-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-(2.3.2)_378x150_98x63.jpg as test_upload_dir_86886/test_sync/02_-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-_2.3.2__378x150_98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/Ek_Bremen_P+R Syke_200x200.jpg as test_upload_dir_86886/test_sync/Ek_Bremen_P_R_Syke_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/NoSpaces/OrdinaryFilename.png as test_upload_dir_86886/test_sync/NoSpaces/OrdinaryFilename
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/Philips Lifetime_200x150.jpg as test_upload_dir_86886/test_sync/Philips_Lifetime_200x150
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/SomeName/(02)-some-real_File-Name-Zone-(2.3.2)_378x150_98x63.jpg as test_upload_dir_86886/test_sync/SomeName/02_-some-real_File-Name-Zone-_2.3.2__378x150_98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/Speed_Grip 3_05_200x200.jpg as test_upload_dir_86886/test_sync/Speed_Grip_3_05_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/hymer-1-2_)_98x63.jpg as test_upload_dir_86886/test_sync/hymer-1-2___98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/specialCharactersätstest_1234/Einzelkritiken/(02)-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-(2.3.2)_378x150_98x63.jpg as test_upload_dir_86886/test_sync/specialCharactersätstest_1234/Einzelkritiken/02_-Krummhoern-Upleward_Badetreppe-Kitesurf-Zone-_2.3.2__378x150_98x63
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/test with spaces/test_space 3_05_200x200.jpg as test_upload_dir_86886/test_sync/test with spaces/test_space_3_05_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/test-h7/Philips Lifetime_200x150.jpg as test_upload_dir_86886/test_sync/test-h7/Philips_Lifetime_200x150
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/test_underscores____test/Ek_Bremen_P+R Syke_200x200.jpg as test_upload_dir_86886/test_sync/test_underscores____test/Ek_Bremen_P_R_Syke_200x200
Successfully uploaded /Users/christophersnyder/Projects/cloudinary-cli/test/resources/test_sync/wohnmobil-2010/hymer-1-2_)_98x63.jpg as test_upload_dir_86886/test_sync/wohnmobil-2010/hymer-1-2___98x63
/usr/local/Cellar/python@3.9/3.9.16/Frameworks/Python.framework/Versions/3.9/lib/python3.9/multiprocessing/pool.py:265: ResourceWarning: unclosed running multiprocessing pool <multiprocessing.pool.ThreadPool state=RUN pool_size=30>
  _warn(f"unclosed running multiprocessing pool {self!r}",
ResourceWarning: Enable tracemalloc to get the object allocation traceback
12 resources uploaded
  1. Compare and note that the test cloud environment returns different Public IDs. Sometimes invalid. For example, note how the characters ), (, +, (spaces) in the file names are treated differently by each environment.

Error screenshots or Stack Trace (if applicable)

Operating System

Environment and Frameworks (fill in the version numbers)

Repository

If possible, please provide a link to a reproducible repository that showcases the problem

chrissnyder2337 commented 1 year ago

With some additional testing, I found that the Cloudinary test cloud is also returning invalid Public IDs with the following characters: <, &, #, ?.

PixelCook commented 1 year ago

Hey Chris,

I don't see any upload failures and I couldn't find any examples of assets with unpermitted characters in your DAM. Are you receiving any error messages from Cloudinary?

chrissnyder2337 commented 1 year ago

@PixelCook

That is because the issue is with the Test Cloud, not my DAM. The test cloud is used when running python unit tests within the ci runners.

I have added steps to reproduce in the issue description.

const-cloudinary commented 1 year ago

@chrissnyder2337 , there is this support post: https://support.cloudinary.com/hc/en-us/articles/115001317409--Legal-naming-conventions

Nothing to do with the CLI.

chrissnyder2337 commented 1 year ago

Yes this is not an issue with the CLI, it is an issue with the test cloud that the CLI uses. That is what I am trying to point out. The "test cloud" is returning illegal public ids, and does not match what a real Cloudinary cloud account would return. This impacts the CLI development because the "test cloud", used by tests in this project, is returning illegal public ids, and does not match what a real Cloudinary cloud account would return. This impacts the ability to write accurate tests.

There may be another project/place that this issue could be moved to.

Vdeub-cloudinary commented 1 year ago

@chrissnyder2337 Would you mind sharing the cloud name for both your production and test accounts? Thanks

Vdeub-cloudinary commented 1 year ago

@chrissnyder2337 For security reasons, I had to delete your comment as you added your credentials and especially the API_SECRET. I got the information needed and I'll have a deeper look.

Vdeub-cloudinary commented 1 year ago

@chrissnyder2337 @const-cloudinary - it seems the test clouds are using custom flags that are not used by classic accounts. Especially, the test clouds were configured to allow specific characters in a public_id. I believe that's why there was a difference