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

CarrierWave does not change cached file extension after form reload #2254

Closed
tpltn opened this issue Nov 25, 2017 · 0 comments
Closed

CarrierWave does not change cached file extension after form reload #2254

tpltn opened this issue Nov 25, 2017 · 0 comments

Comments

@tpltn
Copy link

tpltn commented Nov 25, 2017

Steps to reproduce

Uploader

class ImageUploader < CarrierWave::Uploader::Base
  include CarrierWave::MiniMagick

  storage :file
  process convert: 'jpg'
end

Form

...
<%= form.text_field :title %>

<%= form.file_field :image %>
<%= form.hidden_field :image_cache %>
...

Model

class Project < ApplicationRecord
  mount_uploader :image, ImageUploader

  validates_presence_of :title
  validates_integrity_of :image
  validates_processing_of :image
end
  1. Select image.png via file_field browser, but don't fill required title field
  2. Submit form and get error: title is required
  3. Fill title and submit form again

Expected behavior

Image is converted to jpg and saved as image.jpg

Actual behavior

Image is converted to jpg and saved as image.png (with original file name)

System configuration

Ruby version: 2.4.2
Rails version: 5.1.4
CarrierWave version: 1.2.1

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