-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
The code depends on @original_filename
doesn't work since v3.0.4
#2708
Comments
Also facing this same issue. In previous versions, the original filename would be stored when called I noticed this commit reassigns the original_filename. Here are the two uploader outputs after calling uploader.store!(file):
|
First, the example implementation
is safeguarded with Also I want to understand the real use case of that
the return value changes time to time and does not reflect the stored file's name. So it's not a stable way to get the filename. |
There is a note about changes in original_filename here and original_filename isn't the original filename as explained in #2710 (comment) Although, it is still used in the generator, carrierwave/lib/generators/templates/uploader.rb.erb Lines 42 to 46 in 0c50a8b
and cfaf173 was definitely a breaking change... |
I'm not sure about the detailed history, the code generated by the generator is wrong now, right? carrierwave/lib/generators/templates/uploader.rb.erb Lines 42 to 46 in 0c50a8b
If so, I'm OK with fixing our application code. But it looks like this is a breaking change and introducing a breaking change in a newer minor version violates semantic versioning. I think it's good to support old behavior at least in a minor update, what do you think? |
To tell if it actually is or not, it is important to understand the real use case. It can be either a behavior that should be considered as a specification, or that you're just depending on what happened to work in the past. |
As many people (including this) seems to be struggling, I got an idea. |
The
uploader.rb
generated by generators has an example of how to override the filename. The code is the following.carrierwave/lib/generators/templates/uploader.rb.erb
Lines 42 to 46 in 0c50a8b
But, I think this code doesn't work since v3.0.4 because
@original_filename
is set to nil afterstore
by #2707.So that example always returns
nil
now. The reproduction script is the following.Is this an intended change?
The text was updated successfully, but these errors were encountered: