From 9ee93aad5b91196b10695f364913f3c8ceca4063 Mon Sep 17 00:00:00 2001 From: Sam Date: Tue, 8 Jul 2014 17:20:27 +1000 Subject: [PATCH] FIX: letter avatars to live in uploads directory, add last modified --- app/controllers/user_avatars_controller.rb | 1 + lib/letter_avatar.rb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/user_avatars_controller.rb b/app/controllers/user_avatars_controller.rb index cf8640e27d8..e5ec3087969 100644 --- a/app/controllers/user_avatars_controller.rb +++ b/app/controllers/user_avatars_controller.rb @@ -29,6 +29,7 @@ class UserAvatarsController < ApplicationController end image = LetterAvatar.generate(params[:username].to_s, params[:size].to_i) + response.headers["Last-Modified"] = File.ctime(image).httpdate expires_in 1.year, public: true send_file image, disposition: nil end diff --git a/lib/letter_avatar.rb b/lib/letter_avatar.rb index 61c80c87e82..d7da8541e57 100644 --- a/lib/letter_avatar.rb +++ b/lib/letter_avatar.rb @@ -25,7 +25,7 @@ class LetterAvatar def cache_path - "tmp/letter_avatars/#{VERSION}" + "public/uploads/letter_avatars/#{VERSION}" end def generate(username, size, opts = nil)