@@ -155,11 +155,12 @@ def self.load_configs_in(dir)
155
155
156
156
extname = File . extname ( path ) . downcase
157
157
pass unless settings . image_extnames . include? ( extname )
158
+ image_format = extname [ 1 ..-1 ]
158
159
159
160
basename = File . basename ( path , extname )
160
161
dirname = File . dirname ( path )
161
162
162
- # A
163
+ # Manipulated?
163
164
if dirname =~ /\/ (fit-|fill-)?(\d +)x?(\d *)$/ || dirname =~ /\/ (fit-|fill-)?(\d *)x(\d +)$/
164
165
manipulation = File . basename ( dirname )
165
166
dirname = File . dirname ( dirname )
@@ -184,6 +185,8 @@ def self.load_configs_in(dir)
184
185
185
186
if ( ( retina_in == retina_out ) || retina_out ) && !manipulation && File . extname ( path ) == extname
186
187
# No [useful] modifications to make, return the original.
188
+ content_type image_format . to_sym
189
+ cache_control :public , :must_revalidate , max_age :settings . image_max_age
187
190
send_file ( path )
188
191
else
189
192
image = Magick ::Image . read ( path ) . first
@@ -229,9 +232,9 @@ def self.load_configs_in(dir)
229
232
raise StandardError , 'Unreachable code reached!'
230
233
end
231
234
232
- image . format = extname [ 1 ..- 1 ]
235
+ image . format = image_format
233
236
234
- content_type image . format . to_sym
237
+ content_type image_format . to_sym
235
238
cache_control :public , :must_revalidate , max_age :settings . image_max_age
236
239
image . to_blob
237
240
end
0 commit comments