Skip to content

Commit 7dba0a7

Browse files
Merge branch 'test' of github.com:code-dot-org/code-dot-org into staging
2 parents 21509b2 + cd5fcd1 commit 7dba0a7

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

pegasus/router.rb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,12 @@ def self.load_configs_in(dir)
155155

156156
extname = File.extname(path).downcase
157157
pass unless settings.image_extnames.include?(extname)
158+
image_format = extname[1..-1]
158159

159160
basename = File.basename(path, extname)
160161
dirname = File.dirname(path)
161162

162-
# A
163+
# Manipulated?
163164
if dirname =~ /\/(fit-|fill-)?(\d+)x?(\d*)$/ || dirname =~ /\/(fit-|fill-)?(\d*)x(\d+)$/
164165
manipulation = File.basename(dirname)
165166
dirname = File.dirname(dirname)
@@ -184,6 +185,8 @@ def self.load_configs_in(dir)
184185

185186
if ((retina_in == retina_out) || retina_out) && !manipulation && File.extname(path) == extname
186187
# 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
187190
send_file(path)
188191
else
189192
image = Magick::Image.read(path).first
@@ -229,9 +232,9 @@ def self.load_configs_in(dir)
229232
raise StandardError, 'Unreachable code reached!'
230233
end
231234

232-
image.format = extname[1..-1]
235+
image.format = image_format
233236

234-
content_type image.format.to_sym
237+
content_type image_format.to_sym
235238
cache_control :public, :must_revalidate, max_age:settings.image_max_age
236239
image.to_blob
237240
end

0 commit comments

Comments
 (0)