Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate_transformation_string destructively eats the transformation key out of the hash #61

Closed
skwp opened this issue Mar 20, 2013 · 3 comments

Kommentare

@skwp
Copy link

skwp commented Mar 20, 2013

I will soon have a pull request with tests that shows this bug and provides a fix. The generate_transformation_string method eats the 'transformatoin' key from the hash passed into it. If you're using attachinary, this hash is also used in the front end to generate form data, so the form ends up without the transformation key in it.

Logged as Ticket 8567 in the cloudinary support system. Additionally, after reading through the cloudinary gem code, I am not inspired with confidence to the backend service. We can do better than 50 lines long methods :)

@TalLevAmi
Copy link
Contributor

The generate_transformation_string is an internal method and is not intended for use externally. It destructively updates the received hash parameter as indicated by the comment above the method.

Do you require a helper method for calling this method directly? Something that cannot be done with the cloudinary_url helper methods?

@TalLevAmi
Copy link
Contributor

OK, now I understand what you are referring too. There is indeed a problem in Cloudinary::Uploader calling generate_transformation_string without cloning it fix. We will issue a fix shortly.

@skwp
Copy link
Author

skwp commented Mar 20, 2013

Yep that's what I mean. fyi it's called from Attachinary via

Cloudinary::Uploader.build_upload_params(options[:cloudinary])

Which then calls the method in question, which destructively modifies options[:cloudinary]

I would say even if the method is "internal" you should strive for idempotence and not destroying incoming parameters. It leads to extremely hard to track down bugs. And since it's not truly internal because it's public and called by other public methods, you have the potential to leak out very dangerous effects into calling code.

@skwp skwp closed this as completed Mar 20, 2013
nadavs added a commit that referenced this issue Mar 20, 2013
…port for rails4 sass asset path integration, Flag to prevent cloudinary from downloading remote urls directly, Issue #61 build_upload_params destructively updates options
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants