correct regression uploading images
This commit is contained in:
parent
937ab3f213
commit
f62073a22a
|
@ -125,8 +125,8 @@ class OptimizedImage < ActiveRecord::Base
|
|||
|
||||
IM_DECODERS ||= /\A(jpe?g|png|tiff?|bmp|ico|gif)\z/i
|
||||
|
||||
def self.prepend_decoder!(path, ext_path)
|
||||
extension = File.extname(ext_path)[1..-1]
|
||||
def self.prepend_decoder!(path, ext_path = nil)
|
||||
extension = File.extname(ext_path || path)[1..-1]
|
||||
raise Discourse::InvalidAccess unless extension.present? && extension[IM_DECODERS]
|
||||
"#{extension}:#{path}"
|
||||
end
|
||||
|
|
|
@ -57,6 +57,9 @@ describe UserAvatarsController do
|
|||
|
||||
expect(OptimizedImage.where(upload_id: upload.id).count).to eq(1)
|
||||
expect(response.status).to eq(200)
|
||||
|
||||
upload.reload
|
||||
expect(upload.extension).to eq('png')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue